如何集成 Amazon EKS 和 Jenkins [英] How to Integrate Amazon EKS and Jenkins
问题描述
我目前在 Jenkins 中使用 Kubernetes 客户端插件,但配置起来仍然令人困惑,因为它会查找 Kubernetes 配置,即使我在凭据部分配置了这些凭据,这些凭据也不可用.
请参阅下面的屏幕截图,了解我在 Jenkins 中配置的凭据.
当我尝试从 Jenkins 端添加这些凭据时,这些凭据未列在 Kubernetes 凭据下.红色的没有我的凭据.
如何在 Jenkins 中配置这个 Kubernetes 插件?或任何其他配置 Jenkins + Amazon EKS 的替代方法?
谢谢.
插件:
接下来在左侧的下拉菜单中选择秘密文本"以添加按钮、测试连接、应用和保存.
-检查凭据:
-再次勾选Manage Jenkins"-->Configure System"--> Cloud部分
希望能帮到你...
I'm currently using Kubernetes Client Plugin in Jenkins but still it's confusing to configure, because it looks for Kubernetes config, and those credetials are not available even I configured them in the credentials section.
Please see the screenshot below for my credentials which are configure in my Jenkins.
When I do try to add those credentials from Jenkins side, which is not listed under the Kubernetes credentials. The red colored are has no kist of my credentials.
How can I configure this Kubernetes plugin in Jenkins ? or any other alternative methods to configure Jenkins + Amazon EKS ?
Thanks.
Plugin : https://wiki.jenkins.io/display/JENKINS/Kubernetes+Plugin
To reproduce your issue I have installed EKS using Deploying a Kubernetes Cluster with Amazon EKS article.
After adding worker nodes next steps were performed:
1) install helm
2) install jenkins from stable/jenkins chart.
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
Wait until everything will be deployed, you can check via 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
Next
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
Open browser, login and go to "Manage Jenkins"-->"Configure System"--> Cloud Section
Click Add - Jenkins
Choose
Kubernetes Service Account
and click add..Next chose "Secret Text" in drop down menu left to Add button, Test connection, apply and save.
-Check Credentials:
-Check again "Manage Jenkins"-->"Configure System"--> Cloud Section
Hope it helps...
这篇关于如何集成 Amazon EKS 和 Jenkins的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!