【无标题】

Jenkins 对接kubernetes

jenkins是否部署在集群外?

集群内安装Jenkins
root@k8s-master01:~/learning-k8s/jenkins# kubectl apply -f deploy/

集群外Jenkins安装插件

kubernetes

【无标题】_第1张图片

k8s服务证书
root@k8s-master01:~# cat /etc/kubernetes/pki/ca.ke

进入Jenkins容器,查看 
ot@k8s-master03:~# kubectl exec -it -n jenkins jenkins-dc5478948-qtnzr -- bash
Defaulted container "jenkins" out of: jenkins, fix-permissions (init)
jenkins@jenkins-dc5478948-qtnzr:/$ ls
bin  boot  dev	etc  home  lib	lib32  lib64  libx32  media  mnt  opt  proc  root  run	sbin  srv  sys	tmp  usr  var
jenkins@jenkins-dc5478948-qtnzr:/$ cat /var/run/secrets/kubernetes.io/serviceaccount/
..2023_11_13_16_16_48.3466224108/ ca.crt                            token                             
..data/                           namespace                         
jenkins@jenkins-dc5478948-qtnzr:/$ cat /var/run/secrets/kubernetes.io/serviceaccount/token && echo
eyJhbGciOiJSUzI1NiIsImtpZCI6IklQaC1rY29PSDVqMlZGblpYbVpwMGhzN0V2Nm5jSFNTd3Vmc1dBQ0dTa1EifQ.eyJhdWQiOlsiaHR0cHM6Ly9rdWJlcm5ldGVzLmRlZmF1bHQuc3ZjLmNsdXN0ZXIubG9jYWwiXSwiZXhwIjoxNzMxNDI4MjA4LCJpYXQiOjE2OTk4OTIyMDgsImlzcyI6Imh0dHBzOi8va3ViZXJuZXRlcy5kZWZhdWx0LnN2Yy5jbHVzdGVyLmxvY2FsIiwia3ViZXJuZXRlcy5pbyI6eyJuYW1lc3BhY2UiOiJqZW5raW5zIiwicG9kIjp7Im5hbWUiOiJqZW5raW5zLWRjNTQ3ODk0OC1xdG56ciIsInVpZCI6IjZhZmE5OGU2LTYzNDgtNDZkMC1hZmNhLTY5NTg5Y2U4YjZlMyJ9LCJzZXJ2aWNlYWNjb3VudCI6eyJuYW1lIjoiamVua2lucy1tYXN0ZXIiLCJ1aWQiOiI2YWY3ZDAzOS03YjViLTRkZTgtYmEwZi1mZWI1NDFiYjIzODMifSwid2FybmFmdGVyIjoxNjk5ODk1ODE1fSwibmJmIjoxNjk5ODkyMjA4LCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6amVua2luczpqZW5raW5zLW1hc3RlciJ9.WPHAXsICPjAR0yANrRwuVw8As3bSOGpp1oRN07RF6m9Tpi8u-4s-1parY_Oej__D4Qe0xKibnlj2sfFHNwC_AL2-yoKC1NjgXNMyuN-OcTOq9kBvT0I7JQpvqkZ5ILAWiCa3RCfdq-KdJCk5TNT3IYKI8TtLtYTXf70NQT6MdoUCW_dZJC3rjApUcsP45_F3ekt5GK2cz0o3xWuJkbV-oSjOJRaKmWnO-JVw0Ch4cipgzgKGTYLmWOm6g79ceUal4VC_0vdsoj_HxDVxa88hzjSZnIZ7IC1_G8aKx0QyweXDH_ZC-_oPcbk5SrsOIl5igudTa76y7yzdu5dZ5DfVSw

添加上面的
【无标题】_第2张图片
https://192.168.1.180:6443 k8s apiservre

192.168.1.51:50000 这个是集群外Jenkins
【无标题】_第3张图片

你可能感兴趣的:(jenkins)