0

有谁知道如何用 jenkins 设置 kubectl?Jenkins 在可以与 AWS EKS 集群通信的 AWS EC2 上运行。

当我在 jenkins 中以 kubectl 版本运行 shell 脚本时,我得到:

+ 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
4

3 回答 3

1

以正确方式配置它的一种方法是使用Jenkins Kubernetes 插件https ://illya-chekrygin.com/2017/08/26/configuring-certificates-for-jenkins-kubernetes-plugin-0-12/

另一种是将集群 kubeconfig 文件传递​​给 kubectl。

于 2018-11-20T12:21:08.010 回答
0

从 aws eks 导出命令中删除 ~/,然后您可以轻松地为 aws eks 设置 kubectl。

于 2018-11-20T16:53:33.567 回答
0

有多种方法可以做到这一点。检查以下由AWS发布的链接。根据链接。对于 EKS,您可以使用 Jenkins X。它专为 K8s 设计。

https://aws.amazon.com/blogs/opensource/continuous-delivery-eks-jenkins-x/

于 2018-11-20T12:30:41.793 回答