首页 > 其他分享 >k8s部署Jenkins

k8s部署Jenkins

时间:2022-10-09 16:37:49浏览次数:52  
标签:name 部署 namespace jenkins Jenkins k8s 30082 resources

kind: Deployment
apiVersion: apps/v1
metadata:
labels:
k8s-app: jenkins
name: jenkins
namespace: devops
spec:
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
k8s-app: jenkins
template:
metadata:
labels:
k8s-app: jenkins
namespace: devops
name: jenkins
spec:
hostAliases:
- ip: "192.168.194.101"
hostnames:
- "updates.jenkins-ci.org"
nodeSelector:
key: "devops"
containers:
- name: jenkins
image: jenkinsci/blueocean
imagePullPolicy: IfNotPresent
ports:
- containerPort: 30082
name: web
protocol: TCP
- containerPort: 30081
name: agent
protocol: TCP
resources:
limits:
cpu: 1000m
memory: 4Gi
requests:
cpu: 500m
memory: 512Mi
livenessProbe:
httpGet:
path: /login
port: 30082
initialDelaySeconds: 60
timeoutSeconds: 5
failureThreshold: 12
readinessProbe:
httpGet:
path: /login
port: 30082
initialDelaySeconds: 60
timeoutSeconds: 5
failureThreshold: 12
volumeMounts:
- name: jenkins-home
mountPath: /var/lib/jenkins
env:
- name: JENKINS_HOME
value: /var/lib/jenkins
- name: JENKINS_OPTS
value: --httpPort=30082
- name: JENKINS_SLAVE_AGENT_PORT
value: "30081"
securityContext:
runAsUser: 0
volumes:
- name: jenkins-home
hostPath:
path: /data/devops/jenkins
type: Directory
serviceAccountName: jenkins
---
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
k8s-app: jenkins
name: jenkins
namespace: devops
---
kind: Service
apiVersion: v1
metadata:
labels:
k8s-app: jenkins
name: jenkins
namespace: devops
spec:
type: NodePort
ports:
- name: web
port: 30082
targetPort: 30082
nodePort: 30082
- name: slave
port: 30081
targetPort: 30081
nodePort: 30081
selector:
k8s-app: jenkins
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: jenkins
namespace: devops
rules:
- apiGroups: ["extensions", "apps"]
resources: ["deployments"]
verbs: ["create", "delete", "get", "list", "watch", "patch", "update"]
- apiGroups: [""]
resources: ["services"]
verbs: ["create", "delete", "get", "list", "watch", "patch", "update"]
- 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/v1
kind: ClusterRoleBinding
metadata:
name: jenkins
roleRef:
kind: ClusterRole
name: jenkins
apiGroup: rbac.authorization.k8s.io
subjects:
- kind: ServiceAccount
name: jenkins
namespace: devops
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: jenkins
namespace: devops
spec:
rules:
- host: jenkins.test.com
http:
paths:
- backend:
service:
name: jenkins
port:
number: 30082
path: /
pathType: ImplementationSpecific

标签:name,部署,namespace,jenkins,Jenkins,k8s,30082,resources
From: https://blog.51cto.com/u_11410590/5740691

相关文章

  • k8s 网络策略
         公司内部搭建calico满足,如果公共的则采用flannel......
  • k8s笔记1
    1、watch后的命令不能使用别名alias#watchkgetpod-nkube-system-owidesh:k:未找到命令#watchkubectlgetpods--all-namespaces2、 k8s-master02状态:NotReady,......
  • k8s集群环境下kubesphere部署
    安装kubernetes1、环境配置每个机器使用内网ip互通每个机器配置自己的hostname,不能用localhost所有机器均操作#设置每个机器自己的hostnamehostnamectlset-host......
  • docker部署项目注意事项记录
    1.不同容器之前通信,如前端容器与后端容器,需要注意配置文件(如前端nginx的nginx.conf,后端的application.yml)里的ip地址要为宿主机的具体ip,如192.168.0.12,而不能为loca......
  • supervisor 部署及管理进程
    部署yum-yinstallepel-releaseyum-yinstallsupervisor查看配置systemctlcatsupervisord   修改配置   #主要是内存 文件打开数[root@bogon......
  • docker jenkins升级以及失败处理
    一、概述jenkins是由docker安装的,目前的jenkins版本为2.356。然后jenkins右上角提示版本升级 点击了升级,升级完成后,需要重启一下。然后就芭比Q了,访问jenkins出现504......
  • k8s 学习整体架构
     对于为什么要学习k8s,k8s 有什么用。 我用已经学过的知识来侧面的阐述。计算机的发展就是这样的,在没有操作系统出来之前,很多操作都是比较麻烦的,对资源的调度管理,等等。......
  • k8s 网络通信模式
    ## 使用容器化技术有这样一个难题 就是如何实现容器之间通过ip地址进行通信。还有一个难题就是如何实现不同宿主机之间的容器相互通信。  来看看 flannel 解决这个......
  • k8s 的一些基本概念 Pod
    ##Pod  我们在实际开发中,往往需要两个或者来两个以上的容器形成工作组,共同完成工作,比方说:nginx 和tomcat,通过nginx 反向代理到 tomcat  我们就可以通过 POd来帮......
  • k8s部署nacos
    部署mysql参考:官网:https://nacos.io/zh-cn/docs/use-nacos-with-kubernetes.htmlsql脚本地址:https://github.com/alibaba/nacos/blob/master/config/src/main/resources......