我已关注these instructions for setting up a kubernetes cluster on AWS using kops.
然后我能够运行kubectl create -f ...
命令来运行应用程序。
我可以在我的浏览器中访问https://api.useast1.dev.example.com/
处的API(我认为是这样)。
这会提示您进行身份验证,我通过运行
获取凭据kubectl config view --minify
根据these instructions from the kops github。
然后API会显示:
{
"paths": [
"/apis",
"/apis/",
"/apis/apiextensions.k8s.io",
"/apis/apiextensions.k8s.io/v1beta1",
"/healthz",
"/healthz/etcd",
"/healthz/ping",
"/healthz/poststarthook/generic-apiserver-start-informers",
"/healthz/poststarthook/start-apiextensions-controllers",
"/healthz/poststarthook/start-apiextensions-informers",
"/metrics",
"/swagger-2.0.0.json",
"/swagger-2.0.0.pb-v1",
"/swagger-2.0.0.pb-v1.gz",
"/swagger.json",
"/swaggerapi",
"/version"
]
}
现在我正在尝试设置GitLab CI,它请求API端点和服务令牌。
我使用these instructions from kubernetes创建了一个服务令牌,虽然我还没有完成imagePullSecret部分。
但是,当我在kubernetes集群上尝试任何事情时(例如安装Helm Tiller),它会给我:Kubernetes error: Unauthorized
。我认为这是因为我没有给它任何访问该API的凭据。
如何设置kubernetes集群,以便Gitlab不需要这些凭据来访问API?
答案 0 :(得分:2)
好的,对于令牌是什么有点混淆。
检索令牌的最佳方法是:
kubectl get secrets
列出秘密
然后
kubectl describe secret SECRET_NAME
检索令牌。