使用 jenkins 设置 kubectl
Setup kubectl with jenkins
有人知道如何使用 jenkins 设置 kubectl 吗?
Jenkins 运行正在 AWS EC2 上运行,它可以与 AWS EKS 集群通信。
当我在 jenkins 中将 运行 shell 脚本作为 kubectl 版本时,我得到:
+ kubectl version
输出:
Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.3", GitCommit:"2bba0127d85d5a46ab4b778548be28623b32d0b0", GitTreeState:"clean", BuildDate:"2018-07-26T20:40:11Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}
Error from server (Forbidden): <html><head><meta http-equiv='refresh' content='1;url=/login?from=%2Fversion'/> <script>window.location.replace('/login?from=%2Fversion');</script></head> <body style='background-color:white; color:white;'>
Authentication required
<!--
You are authenticated as: anonymous
Groups that you are in:
Permission you need to have (but didn't): hudson.model.Hudson.Read
... which is implied by: hudson.security.Permission.GenericRead
... which is implied by: hudson.model.Hudson.Administer
-->
</body></html>
Build step 'Execute shell' marked build as failure
正确配置它的方法之一是使用Jenkins Kubernetes plugin: https://illya-chekrygin.com/2017/08/26/configuring-certificates-for-jenkins-kubernetes-plugin-0-12/
另一种是将集群kubeconfig文件传递给kubectl。
有多种方法可以做到这一点。查看下面由 AWS 发布的 link。根据link。对于 EKS,您可以使用 Jenkins X。它专为 K8s 设计。
https://aws.amazon.com/blogs/opensource/continuous-delivery-eks-jenkins-x/
从 aws eks 导出命令中删除 ~/,然后您可以轻松地为 aws eks 设置 kubectl。
有人知道如何使用 jenkins 设置 kubectl 吗? Jenkins 运行正在 AWS EC2 上运行,它可以与 AWS EKS 集群通信。
当我在 jenkins 中将 运行 shell 脚本作为 kubectl 版本时,我得到:
+ kubectl version
输出:
Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.3", GitCommit:"2bba0127d85d5a46ab4b778548be28623b32d0b0", GitTreeState:"clean", BuildDate:"2018-07-26T20:40:11Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}
Error from server (Forbidden): <html><head><meta http-equiv='refresh' content='1;url=/login?from=%2Fversion'/> <script>window.location.replace('/login?from=%2Fversion');</script></head> <body style='background-color:white; color:white;'>
Authentication required
<!--
You are authenticated as: anonymous
Groups that you are in:
Permission you need to have (but didn't): hudson.model.Hudson.Read
... which is implied by: hudson.security.Permission.GenericRead
... which is implied by: hudson.model.Hudson.Administer
-->
</body></html>
Build step 'Execute shell' marked build as failure
正确配置它的方法之一是使用Jenkins Kubernetes plugin: https://illya-chekrygin.com/2017/08/26/configuring-certificates-for-jenkins-kubernetes-plugin-0-12/
另一种是将集群kubeconfig文件传递给kubectl。
有多种方法可以做到这一点。查看下面由 AWS 发布的 link。根据link。对于 EKS,您可以使用 Jenkins X。它专为 K8s 设计。
https://aws.amazon.com/blogs/opensource/continuous-delivery-eks-jenkins-x/
从 aws eks 导出命令中删除 ~/,然后您可以轻松地为 aws eks 设置 kubectl。