Skip to content
This repository was archived by the owner on Sep 26, 2025. It is now read-only.

Commit 3191057

Browse files
committed
added changes
1 parent 14436f2 commit 3191057

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed

Jenkinsfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,19 @@ pipeline {
4848
}
4949
}
5050
}
51+
stage('Deploy_application_to_k8s') {
52+
steps {
53+
script {
54+
dir('kubernetes') {
55+
withKubeConfig(caCertificate: '', clusterName: '', contextName: '', credentialsId: 'k8s', namespace: '', restrictKubeConfigAccess: false, serverUrl: '') {
56+
sh """
57+
kubectl apply -f deployment.yaml
58+
kubectl apply -f service.yaml
59+
"""
60+
}
61+
}
62+
}
63+
}
64+
}
5165
}
5266
}

kubernetes/deployment.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
name: nodejs-project-deployment
6+
spec:
7+
minReadySeconds: 3
8+
replicas: 3
9+
selector:
10+
matchLabels:
11+
app: nodejsproject
12+
strategy:
13+
type: RollingUpdate
14+
rollingUpdate:
15+
maxSurge: 25%
16+
maxUnavailable: 25%
17+
template:
18+
metadata:
19+
name: nodejsproject
20+
labels:
21+
app: nodejsproject
22+
spec:
23+
containers:
24+
- name: nodejsproject
25+
image: nodejs:latest
26+
ports:
27+
- containerPort: 3000
28+
protocol: TCP

kubernetes/service.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
apiVersion: apps/v1
3+
kind: Service
4+
metadata:
5+
name: nodejs-svc
6+
spec:
7+
type: NodePort
8+
selector:
9+
app: nodejs
10+
ports:
11+
- port: 35000
12+
targetPort: 3000
13+
nodePort: 32000

0 commit comments

Comments
 (0)