#6: [Method-1] Deploy to Kubernetes from Jenkins Pipeline | Jenkins CI/CD Pipeline with Kubernetes
DevOps Hint
0:00 / 0:00
#6: [Method-1] Deploy to Kubernetes from Jenkins Pipeline | Jenkins CI/CD Pipeline with Kubernetes
41 920 просмотров · 5 л. назад
DevOps Hint
24,6 тыс. подписчиков
41 920 просмотров · 5 л. назад
In this video we are going to cover Deploy to Kubernetes from Jenkins Pipeline | Jenkins CI/CD for Kubernetes Cluster, Kubernetes Deployment using Jenkins Pipeline
#jenkinspipeline #jenkinscicd #kubernetes
==========================================================
Udemy Courses at Just Rs. 455 : https://bit.ly/2XAJBdc
==========================================================
0:00 Introduction
2:43 Install ssh-agent plugin in Jenkins
3:18 overview of Github repo with sample node js project with Kubernetes deployment and service
4:47 adding k8s clusterand Jenkins pipeline to deploy on Kubernetes
12:48 Build jenkins pipeline to deploy on kubernetes
14:48 verify on Kubernetes cluster and access the app
================================================================
Real Time Online Training and Support on Jenkins CI/CD, Docker, Kubernetes, Helm, Prometheus and Grafana. Contact: +91 98345 14531, +91 73875 24947
=================================================================
Below is jenkins pipeline to deploy on Kubernetes cluster
pipeline{
agent any
stages {
stage('Build Maven') {
steps{
checkout([$class: 'GitSCM', branches: [[name: '*/main']], extensions: [], userRemoteConfigs: [[credentialsId: 'devopshint', url: 'https://github.com/devopshint/jenkins...]]])
}
}
stage('Build Docker Image') {
steps {
script {
sh 'docker build -t devopshint/nodejsapp-1.0:latest .'
}
}
}
stage('Deploy Docker Image') {
steps {
script {
withCredentials([string(credentialsId: 'dockerhub-pwd', variable: 'dockerhubpwd')]) {
sh 'docker login -u devopshint -p ${dockerhubpwd}'
}
sh 'docker push devopshint/nodejsapp-1.0:latest'
}
}
}
stage('Deploy App on k8s') {
steps {
sshagent(['k8s']) {
sh "scp -o StrictHostKeyChecking=no nodejsapp.yaml ubuntu@IPofk8scluster:/home/ubuntu"
script {
try{
sh "ssh ubuntu@IPofk8scluster kubectl create -f ."
}catch(error){
sh "ssh ubuntu@IPofk8scluster kubectl create -f ."
}
}
}
}
}
}
}
Our GitHub repo of sample Node js app, dockerfile, deployment and service
https://github.com/devopshint/jenkins...
Related Videos
#1: How to Build Java Project using Maven in Jenkins | Build a Maven Project using Jenkins
• #3: How to Build Java Project using Maven ...
#2: Build Java Project using Maven in Jenkins Pipeline | Jenkinsfile for Maven Build | Jenkins CI/CD
• #4: Build Java Project using Maven in Jenk...
#3: Build Docker Image using Jenkins Pipeline | Push Docker Image to Docker Hub using Jenkins
• #5: Build Docker Image using Jenkins Pipel...
If you likes our video, please subscribe our channel on YouTube,
/ devopshint