In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
K8s how to deploy distributed jenkins, for this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.
Kubernetes is an open source application used to manage containerized applications on multiple hosts in the cloud platform. The goal of Kubernetes is to make the deployment of containerized applications simple and efficient (powerful). Kubernetes provides a mechanism for application deployment, planning, updating, and maintenance.
The prerequisite is that there is storageclass, and use pvc to create persistent storage and create kube-ops namespace.
Create opspvc here and replace accessmode with readwritemany, because there will be multiple pod to read and write
Then deploy the jenkins master deployment as follows
-apiVersion: extensions/v1beta1kind: Deploymentmetadata: name: jenkins namespace: kube-opsspec: template: metadata: labels: app: jenkins spec: terminationGracePeriodSeconds: 10 serviceAccountName: jenkins containers:-name: jenkins image: jenkins/jenkins:lts imagePullPolicy: IfNotPresent ports:-containerPort: 8080 name: web protocol: TCP-containerPort: 50000 Name: agent protocol: TCP resources: limits: cpu: 2000m memory: 4Gi requests: cpu: 1000m memory: 2Gi livenessProbe: httpGet: path: / login port: 8080 initialDelaySeconds: 60 timeoutSeconds: 5 failureThreshold: 12 readinessProbe: HttpGet: path: / login port: 8080 initialDelaySeconds: 60 timeoutSeconds: 5 failureThreshold: 12 volumeMounts:-name: jenkinshome subPath: jenkins mountPath: / var/jenkins_home env:-name: LIMITS_MEMORY valueFrom: resourceFieldRef: resource: limits.memory Divisor: 1Mi-name: JAVA_OPTS value:-Xmx$ (LIMITS_MEMORY) m-XshowSettings:vm-Dhudson.slaves.NodeProvisioner.initialDelay=0-Dhudson.slaves.NodeProvisioner.MARGIN=50-Dhudson.slaves.NodeProvisioner.MARGIN0=0.85-Duser.timezone=Asia/Shanghai securityContext: fsGroup: 1000 volumes:-name: jenkinshome persistentVolumeClaim: claimName: opspvc---apiVersion: v1kind: Servicemetadata: name: jenkins namespace: Kube-ops labels: app: jenkinsspec: selector: app: jenkins ports:-name: web port: 8080 targetPort: web-name: agent port: 50000 targetPort: agent
Assign permissions and configure rbac as follows
ApiVersion: v1kind: ServiceAccountmetadata: name: jenkins namespace: kube-ops---kind: rbac.authorization.k8s.io/v1beta1metadata: name: jenkins namespace: kube-opsrules:-apiGroups: [""] resources: ["pods"] verbs: ["create", "delete", "get", "list", "patch", "update", "watch"]-apiGroups: [""] resources: ["pods/exec"] verbs: ["create", "delete" "get", "list", "patch", "update", "watch"]-apiGroups: ["] resources: [" pods/log "] verbs: [" get "," list " "watch"]-apiGroups: ["] resources: [" secrets "] verbs: [" get "]-apiVersion: rbac.authorization.k8s.io/v1beta1kind: RoleBindingmetadata: name: jenkins namespace: kube-opsroleRef: apiGroup: rbac.authorization.k8s.io kind: Role name: jenkinssubjects:-kind: ServiceAccount name: jenkins namespace: kube-ops
Install the k8s plug-in and connect remotely to the K8s target cluster
Because Tencent Cloud does not provide tls client authentication, use the account password directly for authentication. Remember, disable https certificate checking and integrate jenkins and K8s.
Draw the point! Jenkins address, what I wrote here is the private network address and exposed port 50000 (used to establish communication with slave), because master and slave are respectively in the impassable k8s cluster, so they need to be connected remotely, while jenkins-ui I exposed to the public as ingress.
Configuration of slave
What needs to be noted here is the list of tags. The tag filled in here needs to be marked on the node of the k8s cluster where slave resides. The name, label, in this field, key is not value. Note here.
Configuration in job
This is the answer to the question about how to deploy distributed jenkins in K8s. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.