Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
jenkins-deployment.yml
apiVersion: v1
kind: List
items:
- apiVersion: v1
kind: Service
metadata:
name: jenkins
labels:
app: jenkins
spec:
# 1) Create Nginx Ingress
# 2) Configure basic auth in Ingress for jenkins.mydomain.com
# 3) Configure Let's Encrypt certs in Kube for jenkins.mydomain.com
# 4) Route traffic: User --https--> Ingress [Basic Auth + TLS Offloading] -> ClusterIP of Jenkins service object in Kube -> Jenkins pod
type: ClusterIP
selector:
app: jenkins
ports:
- name: http
port: 8080
targetPort: 8080
protocol: TCP
- name: slave
port: 50000
protocol: TCP
- apiVersion: apps/v1
kind: Deployment
metadata:
name: jenkins
labels:
app: jenkins
spec:
replicas: 1
selector:
matchLabels:
app: jenkins
progressDeadlineSeconds: 300
template:
metadata:
labels:
app: jenkins
spec:
securityContext:
fsGroup: 1000
runAsUser: 2000
runAsNonRoot: true
containers:
- name: jenkins
image: jenkins/jenkins:lts
ports:
- containerPort: 8080
- containerPort: 50000
volumeMounts:
- name: jenkins-data
mountPath: /var/jenkins_home
- name: jenkins-ssh
mountPath: /var/jenkins_home/.ssh
readOnly: true
livenessProbe:
httpGet:
path: /login
port: 8080
initialDelaySeconds: 60
timeoutSeconds: 5
volumes:
- name: jenkins-data
gcePersistentDisk:
pdName: kubernetes-jenkins
fsType: ext4
- name: jenkins-ssh
secret:
secretName: jenkins-ssh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment