From 60fe3460e5729feae61d30b100dcd7894f657812 Mon Sep 17 00:00:00 2001 From: Rena0891 <62939281+Rena0891@users.noreply.github.com> Date: Tue, 28 Jul 2020 12:39:52 +0530 Subject: [PATCH 1/2] Create train-schedule-kube.yml --- train-schedule-kube.yml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 train-schedule-kube.yml diff --git a/train-schedule-kube.yml b/train-schedule-kube.yml new file mode 100644 index 000000000..4be89b7a1 --- /dev/null +++ b/train-schedule-kube.yml @@ -0,0 +1,36 @@ +kind: Service +apiVersion: v1 +metadata: + name: train-schedule-service +spec: + type: NodePort + selector: + app: train-schedule + ports: + - protocol: TCP + port: 8080 + nodePort: 8080 + +--- + +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: train-schedule-deployment + labels: + app: train-schedule +spec: + replicas: 2 + selector: + matchLabels: + app: train-schedule + template: + metadata: + labels: + app: train-schedule + spec: + containers: + - name: train-schedule + image: $DOCKER_IMAGE_NAME:$BUILD_NUMBER + ports: + - containerPort: 8080 From 137a8aca474ebbda012047e9b1520f38f533e330 Mon Sep 17 00:00:00 2001 From: Rena0891 <62939281+Rena0891@users.noreply.github.com> Date: Tue, 28 Jul 2020 12:45:01 +0530 Subject: [PATCH 2/2] Update Jenkinsfile --- Jenkinsfile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 58c734b2b..c6cf5dcee 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,7 +2,7 @@ pipeline { agent any environment { //be sure to replace "willbla" with your own Docker Hub username - DOCKER_IMAGE_NAME = "willbla/train-schedule" + DOCKER_IMAGE_NAME = "revzheart0891/trainapp" } stages { stage('Build') { @@ -45,8 +45,10 @@ pipeline { steps { input 'Deploy to Production?' milestone(1) - //implement Kubernetes deployment here + kubernetesDeploy( + kubeconfigId: 'kubeconfig', + configs: 'train-schedule-kube.yml', + enableConfigSubstitution: true + ) } } - } -} \ No newline at end of file