diff --git a/Jenkinsfile b/Jenkinsfile index 58c734b2b..54972cc92 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 = "bruno74t/train-schedule" } stages { stage('Build') { @@ -45,7 +45,11 @@ pipeline { steps { input 'Deploy to Production?' milestone(1) - //implement Kubernetes deployment here + kubernetesDeploy( + kubeconfigId: 'kubeconfig', + configs: 'train-schedule-kube.yml', + enableConfigSubstitution: true + ) } } } diff --git a/train-schedule-kube.yml b/train-schedule-kube.yml new file mode 100644 index 000000000..cb78c2ef4 --- /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: apps/v1 +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