Deploying an app to gke from CI

房东的猫 提交于 2020-01-24 23:11:25

问题


I use gitlab for my CI, they host it and i have my own runners. I have a k8s cluster running in gke.

I want to use kubectl apply to deploy new versions of my containers.

This all works from my local machine because it uses my google account.

I tried setting this all up as suggested by k8s and gitlab 1. copy over the ca.crt 2. copy over the token

- echo "$KUBE_CA_PEM" > kube_ca.pem
- kubectl config set-cluster default-cluster --server=$KUBE_URL --certificate-authority="$(pwd)/kube_ca.pem" 
- kubectl config set-credentials default-admin --token=$KUBE_TOKEN
- kubectl config set-context default-system --cluster=default-cluster --user=default-admin
- kubectl config use-context default-system

When i do this it fails with x509: certificate signed by unknown authority

I tried going to the google cloud console > cluster > show credentials and instead of the token specify the username and password that it shows me there, this fails with the same error.

Finally i tried using the --insecure-skip-tls-verify=true but then it complains error: You must be logged in to the server (the server has asked for the client to provide credentials)

Any Help would be appreciated.


回答1:


The cause of this problem was an incorrect server url. The server needs to be the one defined on the cluster information page in the google cloud console. You will find an Endpoing ip address.



来源:https://stackoverflow.com/questions/45626181/deploying-an-app-to-gke-from-ci

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!