我目前在Jenkins中使用Kubernetes客户端插件,但配置仍然令人困惑,因为它会查找Kubernetes配置,即使在凭据部分中配置了这些凭据,这些凭据也不可用。
请在下面的屏幕快照中查看在我的Jenkins中配置的我的凭据。
当我尝试从Jenkins端添加那些凭据时,该凭据未在Kubernetes凭据下列出。红色没有我的证书。
如何在Jenkins中配置此Kubernetes插件?或任何其他替代方法来配置Jenkins + Amazon EKS?
谢谢。
插件:https://wiki.jenkins.io/display/JENKINS/Kubernetes+Plugin
答案 0 :(得分:1)
为重现您的问题,我已使用Deploying a Kubernetes Cluster with Amazon EKS文章安装了EKS。
添加工作程序节点后,执行以下步骤:
1)安装头盔
2)从稳定/詹金斯图表中安装詹金斯。
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get | bash
kubectl create serviceaccount --namespace kube-system tiller
kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
helm init --service-account tiller
helm search jenkins
helm install stable/jenkins --name myjenkins
If you want to change any parameters before deploying helm chart, you can first download and edit values.
helm inspect values stable/jenkins > /tmp/jenkins.values
helm install stable/jenkins --values /tmp/stable_jenkins.values --name myjenkins
在一切部署完成之前,您可以通过watch kubectl get all --all-namespaces
kubectl get all --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
default pod/myjenkins-c9bc6bbbc-hvdzg 1/1 Running 0 19m
kube-system pod/aws-node-5swq5 1/1 Running 0 21m
kube-system pod/aws-node-h5vl7 1/1 Running 0 20m
kube-system pod/aws-node-ttkgn 1/1 Running 0 21m
kube-system pod/coredns-7fb855c998-7lglx 1/1 Running 0 48m
kube-system pod/coredns-7fb855c998-h7stl 1/1 Running 0 48m
kube-system pod/kube-proxy-drvc2 1/1 Running 0 21m
kube-system pod/kube-proxy-gfwh8 1/1 Running 0 20m
kube-system pod/kube-proxy-kscm8 1/1 Running 0 21m
kube-system pod/tiller-deploy-5d6cc99fc-7mv88 1/1 Running 0 45m
NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
default service/kubernetes ClusterIP 10.100.0.1 <none> 443/TCP 48m
default service/myjenkins LoadBalancer 10.100.9.131 ***********************************-*******.eu-west-1.elb.amazonaws.com 8080:30878/TCP 19m
default service/myjenkins-agent ClusterIP 10.100.28.95 <none> 50000/TCP 19m
kube-system service/kube-dns ClusterIP 10.100.0.10 <none> 53/UDP,53/TCP 48m
kube-system service/tiller-deploy ClusterIP 10.100.250.226 <none> 44134/TCP 45m
NAMESPACE NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE
kube-system daemonset.apps/aws-node 3 3 3 3 3 <none> 48m
kube-system daemonset.apps/kube-proxy 3 3 3 3 3 <none> 48m
NAMESPACE NAME READY UP-TO-DATE AVAILABLE AGE
default deployment.apps/myjenkins 1/1 1 1 19m
kube-system deployment.apps/coredns 2/2 2 2 48m
kube-system deployment.apps/tiller-deploy 1/1 1 1 45m
NAMESPACE NAME DESIRED CURRENT READY AGE
default replicaset.apps/myjenkins-c9bc6bbbc 1 1 1 19m
kube-system replicaset.apps/coredns-7fb855c998 2 2 2 48m
kube-system replicaset.apps/tiller-deploy-5d6cc99fc 1 1 1 45m
下一步
1. Get your 'admin' user password by running:
printf $(kubectl get secret --namespace default myjenkins -o jsonpath="{.data.jenkins-admin-password}" | base64 --decode);echo
2. Get the Jenkins URL to visit by running these commands in the same shell:
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get svc --namespace default -w myjenkins'
export SERVICE_IP=$(kubectl get svc --namespace default myjenkins --template "{{ range (index .status.loadBalancer.ingress 0) }}{{ . }}{{ end }}")
echo http://$SERVICE_IP:8080/login
3. Login with the password from step 1 and the username: admin
打开浏览器,登录并转到“管理Jenkins”->“配置系统”->云部分
单击添加-Jenkins
-再次检查“ Manage Jenkins”->“配置系统”->“云”部分
希望有帮助...