hello云胜

技术与生活

0%

编译步骤

ks-apiserver开放

1
2
kubectl -n kubesphere-system patch svc ks-apiserver -p '{"spec":{"type":"NodePort","ports":[{"port":80,"protocal":"TCP","targetPort":9090,"nodePort":30881}]}}'

修改配置文件

server/config.yaml

1
2
3
4
5
6
# backend service gateway server
apiServer:
clientID: kubesphere
clientSecret: kubesphere
url: http://1x.xxx.151.211:30881
wsUrl: ws://1x.xxx.151.211:30881

启动测试

1
2
3
4
npm install -g yarn@1.22.4
yarn
yarn dev:client
yarn dev:server

遇到的问题

yarn 网络失败

修改了npm源

1
2
3
4
5
6
7
8
9
10
npm config set registry https://registry.npm.taobao.org

npm config set disturl https://npm.taobao.org/dist

npm config rm proxy

npm config rm https-proxy

yarn config set sass-binary-site http://npm.taobao.org/mirrors/node-sass

执行了这些步骤仍然失败
删掉了yarn.lock
yarn 成功

或者把yarn.lock里的域名全部换成registry.npmmirror.com

安装cypress失败

1
npm install cypress@3.8.3 --save-dev

使用npm 直接install成功

备用

生成token

1
2
3
4
5
6
7
curl -X POST -H 'Content-Type: application/x-www-form-urlencoded' \
'http://1x.xxx.151.208:30881/oauth/token' \
--data-urlencode 'grant_type=password' \
--data-urlencode 'username=admin' \
--data-urlencode 'password=P@88w0rd' \
--data-urlencode 'client_id=kubesphere' \
--data-urlencode 'client_secret=kubesphere'

测试

1
2
3
curl -X GET -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImFkbWluIiwidG9rZW5fdHlwZSI6ImFjY2Vzc190b2tlbiIsImV4cCI6MTY2NTU5ODE0MywiaWF0IjoxNjY1NTU0OTQzLCJpc3MiOiJrdWJlc3BoZXJlIiwibmJmIjoxNjY1NTU0OTQzfQ.NK8iD4l9WLz4zbO4XeFexzxxaylXiQgizQlIIvKpB9s" \
-H 'Content-Type: application/json' \
'http://1x.xxx.151.208:30881/kapis/resources.kubesphere.io/v1alpha3/nodes'