react 前端框架如何驱动企业数字化转型与创新发展
764
2022-11-30
Jenkins Kubernetes静态agent节点的构建
在命令行中启动节点 java -jar agent.jar -jnlpUrl -secret 942d7e769a43f65388751ee954af20e90fa0c5f8bdb19e0584db4cc61adab8ba -workDir "/var/jenkins"Run from agent command line, with the secret stored in a file: echo 942d7e769a43f65388751ee954af20e90fa0c5f8bdb19e0584db4cc61adab8ba > secret-filejava -jar agent.jar -jnlpUrl -secret @secret-file -workDir "/var/jenkins"
我们不需要对agent创建service去访问它,这就是一个执行引擎,执行完了挂掉 。
[root@master cicd]# cat agent.yaml kind: DeploymentapiVersion: apps/v1metadata: labels: k8s-app: jenkinsagent name: jenkinsagent namespace: devopsspec: replicas: 1 revisionHistoryLimit: 10 selector: matchLabels: k8s-app: jenkinsagent template: metadata: labels: k8s-app: jenkinsagent namespace: devops name: jenkinsagent spec: containers: - name: jenkinsagent image: jenkins/inbound-agent securityContext: privileged: true imagePullPolicy: IfNotPresent resources: limits: cpu: 1000m memory: 2Gi requests: cpu: 500m memory: 512Mi env: - name: JENKINS_URL value: - name: JENKINS_SECRET value: 942d7e769a43f65388751ee954af20e90fa0c5f8bdb19e0584db4cc61adab8ba - name: JENKINS_AGENT_NAME value: build-02 - name: JENKINS_AGENT_WORKDIR value: /home/jenkins/workspace
[root@master cicd]# kubectl apply -f agent.yaml deployment.apps/jenkinsagent created[root@master cicd]# kubectl get pod -n devopsNAME READY STATUS RESTARTS AGEjenkins-797ccbdbc5-84jdl 1/1 Running 0 13mjenkinsagent-586d9594-8pn9w 1/1 Running 0 8s[root@master cicd]# kubectl logs -f jenkinsagent-586d9594-8pn9w -n devopsOct 28, 2021 3:22:40 AM hudson.remoting.jnlp.Main createEngineINFO: Setting up agent: build-02Oct 28, 2021 3:22:40 AM hudson.remoting.jnlp.Main$CuiListener
同样的,这个agent pod里面是没有mvn这些构建工具的,可以使用卷的形式挂载进去。或者使用这个镜像作为基础镜像将工具打入到这个镜像里面更加方便。
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~