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 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