Sorry, but you can use kubectl apply for creation and it will be correct without mistake. I have never used kubectl create, and haven't problem with creation. Thank you for good video.
Hi Java Home Cloud, thanks for this tutorial. I am facing an issue that I can't figure out. I am running this with a Kubernetes cluster. The script runs in an SSH Agent Pod. It says that it adds the SSH key but when I try to SSH to run the deployment in the master node, it fails with "Host key verification failed." It looks like the SSH Agent pod is not getting the Private Key. Any ideas? Happening when it goes smoothly in your video at 11:24.
It's a very useful video .but our Jenkins pipeline fails at the middle how to replace the previous docker tag ,means how to add rollback functionality into the pipeline.
First of all thanks for the simple and clear explanation. I was trying the same k8s deployment on VM with minikube. I am getting one error while building the Jenkins pipeline. /var/lib/jenkins/workspace/deploy-k8s@tmp/durable-0786c27b/script.sh: line 1: kubectl: command not found kubectl command is working in a terminal, but when I was trying this command using Jenkins, it would error. can you please help me to resolve this issue?
I think kubectl Path is not discoverable by Jenkins user, running in the same node of minikube I guess. So first make kubectl executable to others chmod +x `which kubectl` and then define the Path of kubectl executable as an environment variable in the Pipeline
you are building everytime new image with new tag and deploying it, i.e right, but how we can remove old image which are present with same name with different tag? please help on this
iam getting this error in jenins output....please tell how to fix service/nodeapp unchanged error parsing node-app-pod.yml: error converting YAML to JSON: yaml: line 10: mapping values are not allowed in this context error parsing node-app-pod.yml: error converting YAML to JSON: yaml: line 10: mapping values are not allowed in this context
Your explanation is very good👌👌👌👌 but I doubt that can I use kuberenetes continuous deployment plugin for establishing connection between Jenkins and kubernetes server. Please answer me, anybody. Thank you in advance.
It is very nice session. I am facing one issues when try to do ssh from jenkins pipeline. Here we are using KOPS that is creating one master and 2 node . For ssh plugin configuration we need private key and userId. We have admin as userid . For which mahine's private key we need to provide for ssh configuration ? If we need to use of KOPS master private key then how to generate ?. Could you please help on this ?
Hi, I tried your excellent example, but I immediately got the following error -- java.lang.NoSuchMethodError: No such DSL method 'getDockerTag' found among steps I have my getDockerTag method outside of the pipeline {} pipeline { agent any environment { DOCKER_TAG = getDockerTag() IMAGE_URL_WITH_TAG = "somestuff:${DOCKER_TAG}" } stages { stage('Preparation') { steps { git credentialsId: 'GitHub', url: "github.com/url" } } stage('Package and test') { steps { sh '''mvn clean package''' } } stage('Build Docker Image'){ steps{ sh 'docker build . -t ${IMAGE_URL_WITH_TAG}' } } stage('Deploy to K8s Cluster') { steps{ sh 'envsubst < ${WORKSPACE}/deploy.yaml' sshagent(['kops-master']){ sh 'scp -o StrictHostKeyChecking=no deploy.yaml ec2-user@31.2.231.23 :/home/ec2-user/' script{ try{ sh 'ssh ec2-user@31.2.231.23 kubectl apply -f .' // if k8s resource already exists } catch(error){ sh 'ssh ec2-user@31.2.231.23 kubectl create -f .' // if k8s resources does not exists } } } } } } } def getDockerTag(){ def tag = sh script: 'git rev-parse HEAD', returnStdout: true return tag }
This is perfect to deploy onto pre-prod env for continuous integration. But when it comes to deploy the same image to production, how do we move this image onto production kubernetes cluster using jenkins pipeline? Could you please help with this?
please explain line 14 of your code and show us how you got to that line and how it is used. If possible please place into this issue so we have posterity github.com/Ilikef150s2/Sample-Jenkins-Repo/issues/12
Github URL 👉github.com/javahometech/node-app
🌟 Welcome to Java Home Cloud 🌟
Register for Online Training 👉 bit.ly/3vuBQqb
🌐Website 👉javahome.in
this has to be one of the best materials I have ever seen for Jenkins.
Thanks for the video. I was stuck at the tagging part for 1 day and it helped me
Glad it helped!
I had a interview scheduled for k8s task. Your tutorial helped me a lot..thank you
Glad it helped!
@@JavaHomeCloud yes ..it did..thanks
Nice video simple good explanation to make clear understand
Sorry, but you can use kubectl apply for creation and it will be correct without mistake. I have never used kubectl create, and haven't problem with creation. Thank you for good video.
In older versions, it matters
simple and straight. thanks 🙏
You are just genius sir
Good job 👌All The Best from InterviewDOT 🙏
Thank you for sharing. Very clear description 👍
Glad it was helpful!
Great job! Better than the ugly Kubernetes Deploy Plugin! Thx a lot.
These videos are awesome! Thank you!
thank you very much for the video, it was very helpful
You are welcome!
hello,
really great job bro
i have clear all my concept
please make connected video on helm
As soon as possible
How did you install the kubernetes on the ec2 instance, nodes, masters nodes. Can you please tell . Will really help me .
Your videos are just awesome.......
Check my kubernetes playlist to setup clusters
Hi Java Home Cloud, thanks for this tutorial. I am facing an issue that I can't figure out. I am running this with a Kubernetes cluster. The script runs in an SSH Agent Pod. It says that it adds the SSH key but when I try to SSH to run the deployment in the master node, it fails with "Host key verification failed." It looks like the SSH Agent pod is not getting the Private Key. Any ideas?
Happening when it goes smoothly in your video at 11:24.
AWESOME. Just one suggestion: It will be better if you make a separate playlist for the parts where you teach on how to deploy the nodeapp.
Thanks for the tip!
Which aproach is bes if we have 20 docker images for microservices and helm charts to deploy... Is there any jenkins file for example...
Sir, from where value of $1 came into your sed script?
Very useful video.
Simple and Clear!!
Hi, 5:28 timecode - what is the kops-weekend machine. could you help me understand the setup
with the same approach, can we use Nexu3 OSS Docker Reistry instead of Docker Hub to push images from Jenkins and pull that & deploy to AWS EKS??
Hello, Very neatly explained. Thanks. I wanted to know, how to set up the same with AWS ECR instead of Dockerhub.
It's a very useful video .but our Jenkins pipeline fails at the middle how to replace the previous docker tag ,means how to add rollback functionality into the pipeline.
First of all thanks for the simple and clear explanation.
I was trying the same k8s deployment on VM with minikube.
I am getting one error while building the Jenkins pipeline.
/var/lib/jenkins/workspace/deploy-k8s@tmp/durable-0786c27b/script.sh: line 1: kubectl: command not found
kubectl command is working in a terminal, but when I was trying this command using Jenkins, it would error.
can you please help me to resolve this issue?
I think kubectl Path is not discoverable by Jenkins user, running in the same node of minikube I guess.
So first make kubectl executable to others
chmod +x `which kubectl`
and then define the Path of kubectl executable as an environment variable in the Pipeline
you are building everytime new image with new tag and deploying it, i.e right, but how we can remove old image which are present with same name with different tag? please help on this
U can create another pipeline which will delete older docker images.....u might schedule that pipeline
iam getting this error in jenins output....please tell how to fix
service/nodeapp unchanged
error parsing node-app-pod.yml: error converting YAML to JSON: yaml: line 10: mapping values are not allowed in this context
error parsing node-app-pod.yml: error converting YAML to JSON: yaml: line 10: mapping values are not allowed in this context
Can you please post a video on deploying to GKE?
Kubectl apply doesn’t break if resources are not there
Your explanation is very good👌👌👌👌 but I doubt that can I use kuberenetes continuous deployment plugin for establishing connection between Jenkins and kubernetes server.
Please answer me, anybody.
Thank you in advance.
Yes, you can
I have the .pem file, can anyone suggest how to extract private key, which was there in the video.
Please share GitHub url
It is very nice session. I am facing one issues when try to do ssh from jenkins pipeline. Here we are using KOPS that is creating one master and 2 node . For ssh plugin configuration we need private key and userId. We have admin as userid . For which mahine's private key we need to provide for ssh configuration ? If we need to use of KOPS master private key then how to generate ?. Could you please help on this ?
I got this error "The connection to the server localhost:8080 was refused - did you specify the right host or port?"
is it on the k8 cluster?
I have also got a same error
nice tutorial
Thank you! Cheers!
Can we see another pipeline for EKS?
sure
Permission denied (publickey).
lost connection
while deploying to k8s , i have added k8s private key in jenkins . some body please help
Hi, I tried your excellent example, but I immediately got the following error --
java.lang.NoSuchMethodError: No such DSL method 'getDockerTag' found among steps
I have my getDockerTag method outside of the pipeline {}
pipeline {
agent any
environment {
DOCKER_TAG = getDockerTag()
IMAGE_URL_WITH_TAG = "somestuff:${DOCKER_TAG}"
}
stages {
stage('Preparation') {
steps {
git credentialsId: 'GitHub', url: "github.com/url"
}
}
stage('Package and test') {
steps {
sh '''mvn clean package'''
}
}
stage('Build Docker Image'){
steps{
sh 'docker build . -t ${IMAGE_URL_WITH_TAG}'
}
}
stage('Deploy to K8s Cluster') {
steps{
sh 'envsubst < ${WORKSPACE}/deploy.yaml'
sshagent(['kops-master']){
sh 'scp -o StrictHostKeyChecking=no deploy.yaml ec2-user@31.2.231.23 :/home/ec2-user/'
script{
try{
sh 'ssh ec2-user@31.2.231.23 kubectl apply -f .' // if k8s resource already exists
} catch(error){
sh 'ssh ec2-user@31.2.231.23 kubectl create -f .' // if k8s resources does not exists
}
}
}
}
}
}
}
def getDockerTag(){
def tag = sh script: 'git rev-parse HEAD', returnStdout: true
return tag
}
Instead of ansible , could you please make a video of EKS , THAT will be usefull in the realworld
Instead of using ssh, how can we use kubeconfig ? Could you please show some demo ?
you can use a plugin in jenkins or use bitnami/kubectl image and git it the kubeconfig ;)
This is perfect to deploy onto pre-prod env for continuous integration. But when it comes to deploy the same image to production, how do we move this image onto production kubernetes cluster using jenkins pipeline? Could you please help with this?
Came to this video looking for: withCredentials([string(credentialsId: I made an issue and so far no one has explained what it is at 3:19
please explain line 14 of your code and show us how you got to that line and how it is used. If possible please place into this issue so we have posterity
github.com/Ilikef150s2/Sample-Jenkins-Repo/issues/12
you will find it under pipeline syntax
excellent
Many many thanks
I got fallowing error.
"Bad interpreter" in AWS linux Jenkins.
Cloud you share solution.
Send full error stack
@@JavaHomeCloud
+ ./changeTag.sh d7069d93b0c0c437fdd3182f6a95bf067d1d4f66
/var/lib/jenkins/workspace/k8s@tmp/durable-22db45af/script.sh: ./changeTag.sh: /bin/bash^M: bad interpreter: No such file or directory
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 126
Finished: FAILURE
@@JavaHomeCloud
+ ./changeTag.sh d7069d93b0c0c437fdd3182f6a95bf067d1d4f66
/var/lib/jenkins/workspace/k8s@tmp/durable-22db45af/script.sh: ./changeTag.sh: /bin/bash^M: bad interpreter: No such file or directory
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 126
Finished: FAILURE
Change the name from kubernets to kubernetes
thank you
I got this error "/home/cloud_user
Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,password)."
could you ple help me on this
@@HeyMani92 in think in your local machine ssh connection is not in active state r else you have not edited the files which are in git check once
Hello 🎉🎉🎉