从CI部署应用到gke [英] Deploying an app to gke from CI

查看:99
本文介绍了从CI部署应用到gke的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将gitlab用于我的CI,他们托管它,而且我有自己的跑步者. 我有一个在gke中运行的k8s集群.

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

我想使用kubectl apply部署容器的新版本.

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

这一切都可以在我的本地计算机上使用,因为它使用了我的Google帐户.

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

我尝试按照k8s和gitlab的建议进行所有设置 1.复制ca.crt 2.复制令牌

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

当我这样做时,它会失败,并显示x509: certificate signed by unknown authority

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

我尝试去Google Cloud Console>群集>显示凭据,而不是令牌指定在那里显示给我的用户名和密码,但失败并出现相同的错误.

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.

最后我尝试使用--insecure-skip-tls-verify=true,但随后它抱怨error: You must be logged in to the server (the server has asked for the client to provide credentials)

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)

任何帮助将不胜感激.

推荐答案

此问题的原因是服务器网址不正确.该服务器必须是在Google云控制台的群集信息页面上定义的服务器.您将找到一个Endpoing ip地址.

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.

这篇关于从CI部署应用到gke的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆