CICD Pipeline To Deploy To Kubernetes Cluster Using Jenkins | Jenkins Kubernetes Integration
HTML-код
- Опубликовано: 3 ноя 2021
- Welcome to another Interesting Tutorial on DevOps. We are going to use Jenkins, Docker and Kubernetes in this tutorial and will develop and completed Jenkins pipeline to deploy the application to kubernetes cluster.
As part of this jenkins kubernetes deployment pipeline tutorial, we are going to learn the step by step process of integrating Jenkins with Kubernetes, how to install the plugins and configure it.
----------------------------------------------------------------------------
Setup Kubernetes Cluster:
• Create Kubernetes Clus...
----------------------------------------------------------------------------
----------------------------------------------------------------------------
Deploy nodejs application to kubernetes:
• Deploying Node.js Appl...
----------------------------------------------------------------------------
----------------------------------------------------------------------------
Jenkins file github link:
github.com/shazforiot/Jenkins...
---------------------------------------------------------------------------
--------------------------------------------------------------------------
Download Kubernetes Continuous Plugin 1.0 version:
updates.jenkins.io/download/p...
--------------------------------------------------------------------------
=======================================
Follow me @:
/ thetips4you
/ @thetips4you
/ thetipsforyou
www.thetips4you.com
=======================================
Music credit: "Royalty Free Music from Bensound" Наука
Thank you for taking your time for explaining this concept.
You are welcome.
great man first time my kubernetes project from RUclips is executed completely
thanks for your video
You are welcome. Happy to hear.
First time I'm seeing your videos..very helpful and the you are explaining is very understandable.
Thank you for your efforts.
You are welcome. Happy to hear that it is useful for you.
This is an amazing tutorial ! This is gonna be a great help, thank you so much 👍😄
You are welcome my friend.
Great tutorial i am watching in the recent tutorials...very good clear explanation
Thank you so much for this video
Thank you so much. Happy to hear your feedback. Keep supporting.
I have seen couple of videos , but you are the BEST.
That is sounds good to hear. Thank you.
Perfect tutorial, make sure to upload more of these !
Thank you bro.
came here from a reddit post, well worth the click! thanks for clarity.
Really happy to hear this. Thanks
Thanks for this amazing video, it's what I was looking for❤
Thank you
I'm so very thanks for sir. It's very helpful for me and very short and concise.
You are welcome and thank you for your feedback.
Thanks man, was facing issue with the plugin, your link saved lot of time.... Keep Up!!!
Sounds great. Happy to help.
kubernetes-cd plugin is being removed now ...wt r u using ?
@@ramankhanna9526 he using 5 months ago
super explanation.. I was searching it only and it made it.
Thank you
much needed,great job
Thank you
Great Course, thank you.
Glad you like it!. Appreciate your support.
Hai, firstly thanks for this amazing tutorial. I really appreciate your efforts for sharing your knowledge with us. I have a small request, can you please upload more DevOps Projects?
Sure. Thank you
amazing! very good tutorial!
Thank you
Thank you for this video.
My pleasure!. Thanks to you as well.
Really good videos. Really good sharing. I'm very interested in your channel.
Thank you very much!. Really appreciate your support.
Thamk you so much for your video ---Helpfully
You are welcome.
Great session
Thank you
thanks man. nice info
You are welcome.
Super duper good and east to understand thank you so much Sir
Nice to hear. Thank you for your feedback.
@@Thetips4you its really very good I shared with my friends also and they all like it
Thanks a lot.
Really good tutorial, I will do lab
Thank you
Thank so much.❤🔥❤🔥❤🔥
You are welcome
nice bro , keep it up all the best , make a more videos end to end , thankq
Sure Thanks
Marvellous
Thank you
Thank you so much 😊
You are welcome.
many thanks
You are welcome.
excellent
Thank you🙏
thanks fr the video
You are welcome
simply great
Thank you
Good tutorial
Thank you
Very helpfull
Thank you
This video is so helpful to understand the how whole CI-CD workflow works. Thank you. The kubernetes plug-in you use is suspended for its security exploits. Is there any other plugin that we can safely use for kubernetes deployments?
you can use new now its stable
thank you
You are welcome.
Very Good Tutorial. I understood the kube-config file part to authenticate the deployment user against the Cluster. However, without Role Based Access Control(RBAC), how was the deployment done without "Authorization" ?
its an admin kubeconfig file
Very Helpful and appreciate your effort really .
The most painful issue to me with videos here the INDEXING .
Please could you set pre-fix Numbers ( Sorting with numbers) to let me study Playlists in right way ?
Thanks again for your lectures here
Thank you for your feedback. The video's are in order if you check the playlist.
@@Thetips4you Very Good Tutorial. I have ERROR. ERROR: ERROR: io.fabric8.kubernetes.client.KubernetesClientException: Operation: [get] for kind: [Pod] with name: [my-web] in namespace: [default] failed.
hudson.remoting.ProxyException: io.fabric8.kubernetes.client.KubernetesClientException: Operation: [get] for kind: [Pod] with name: [my-web] in namespace: [default] failed.
thanks buddy
You are welcome
Awesome, this content was not available even on paid platforms. I have two questions.
#1. That kubernetes definition file, suppose I have configs, secrets, PV, PVC, in what order those objects will be written.
#2. Please add more tools to this vedio like Nagios, Jfrog, Sonarqube.
#AllTheBest #VeryGoodVideo
Thanks, I will look in to this.
I want to learn DevOps...many people learning web development...but i want something that is new ...... but i saw web development easily understandable.....but when i see DevOps youtube videos...i cant understand what they telling...everything is very complicated.....as a Noob if i have this type of problem by understand.. and no one guide ...then i say i can't be devops engineer.....and now my focus on web devs ...because understanding is most important...thanks
I am not sure why you don't understand DevOps, I would suggest you to start with basics. I understand if no one is there to guide, it will be challenging, you can reach out to me in fb or Instagram if you have any queries. It is also possible that you follow web development and DevOps together.
nice brother great explanation ,on top of this setup could we able install Istio ,if possible for this continuation of this video install istio if possible make video ,thanking you for ur time and knowledge sharing
Sure. Thank you for your feedback.
Cool
Thank you
thank you so much sir for this awesome content . sir if u dont mind can you also integrate ingress loadbalancer controller ?
Will consider it. Thanks
Great video and useful information. I have a question here. When I have multiple namespace like DEV, QA, Staging, how can I define the namespace here? This pipeline deploys on default namespace.
Yes, create a manifest file with kind kind: Namespace, content needed for creating namespace as you need and call that.
Kubernetes Continuous Deploy plugin has been suspended , what plugin can I use instead of this?
Fantastic tutorial. One suggestion though - it sounds like your mic gain might be a little too high, seems to be clipping at certain parts.
But awesome information and walkthrough! Thanks for the info.
Noted!. Not sure why it happened, I also felt after recording that some part of the sound was little bit different.
Thanks for the video, i have one small question where do we find the web ip which we used to return the output on web page
It is based on the kubernetes cluster on which you have published the service.
I'm new to Jenkins, but have the task of deploying to multiple Terraform workspaces (each on for a different customer), then multiple K8s Namespaces (again, one per customer), with a central set of resources that cover all customers, like a central AD server, VPC, etc.... What features of Jenkins pipelines should I be using for this? Can setup variables to describe the differences between customer setups, then set a pipeline to deploy against each? Would folder help me, could I have a folder per customer with nested variables?
Yes you can use variables, you can also setup in git all the configurations based on different branch or different folders as per use case.
Hi. first i would like to thank you for this awesome tutorial.
May I know from 9:12 you are running docker run command. But I did not see you create a jenkins image with docker build. I saw the other videos as well it was not build. nmay I know how you build the jenkins docker image?
You are welcome. You don't need to build Jenkins image. You can use standard existing image of Jenkins in docker hub.
@@Thetips4you thank you. also running docker logs -f [my container id] but no logs are showing , can you please help me
Thank you for your video, I have an issue with GCP K8S.
The token (~/.kube/config) is expired in 30 minutes. How can we handle it?
Usually it should not. Are you using docker or anything different setup?
Hello,
Thank you for the great tutorial. Kubernetes Continuous Deploy plugin was suspended. is there any alternative to it?
Yes. I will check and update the video.
@@Thetips4you sure thank you
@Thetios4you sir can you update asap
@@anandnune I second this. I am lost without Continuous Deploy
@@Thetips4you when r u givin a soln for this !!!
Thank for this video. I have this problem, atfer build , Pod on Kubernetes running, i had update code on github ( change infor myname) =》 commit, jenkins job run finish, but Pod on Kubernetes not change. How to resolve it ?
You are welcome. In this manifest file, it will not do the update on existing pods. You need to edit the configuration to add rolling update or similar strategy.
I think you missed the Github to Jenkins triggering part? using git commit/push
I have a separate video on github triggers to Jenkins.
wt to do about kubernetes plugin not workin ,unable to add config creds to jenkins.....can some1 help on this
great explanation but why using 2 variables
dockerimagename = ""
dockerImage = ""
i did not get it
Dockerimagename is used with reference to your docker hub id and repository name. Dockerimage variable is used to stored the build image, so that we can push it to docker hub using the tag like latest, test etc.
Can we run this command in command prompt to create Jenkins master node?
No.
is there any option to sepcify the namespace in Kubernetesdeploy section?
Use the Kubernetes manifest files for it.
Do you think we can run the kubernetes cli on the kubernetes slave pod on jenkins?
Why do you want to run on slave pod ? Are you asking about running on kubernetes cluster?
@@Thetips4you At my case, I have an AKS cluster and using Kubernetes plugin to run job on the slave. When I run the kubectl apply ... then it said the kubectl command is not available ( i dong use pipeline for app deployment)
Not sure if we have any way to run the kubernetes cli on the build slave?
can you make more videos on jenkins ci/cd pipeline on kubernets with helm ?
Sure
@@Thetips4you DID YOU DONE JENKINS PIPELINE USING HELM
are the jenkins and kubernetes hosted on the same server?
Not necessarily. It depends upon you.
Nice video unfortunately the Kubernetes Continuous Deploy plugin has been suspended due unresolved security issues.
what plugin can be used instead of this?
Can you please create a video like docker and Jenkins for k8 with spring boot microservices
Sure. Will consider it.
@@Thetips4you one more request if you can give an overview of what is cloud native devops. A short video what it is would help
What if I want to customize , by using different docker and kubernetes commands like dockerImage.push(), kubernetesDeploy(). Where to find these commands.
Are you referring to docker commands in pipeline?
can i use github container registry instead of docker hub?
Yes. You will have to adapt the code based on it and the authentication.
brother the kubernetes Deploy plugin has been depricated, now what to do? thanks
Did solve this issue
which terminal u use?
Through putty ssh to centos.
heelo really i am stuck i am following you to make my first devops project but when i created my jenkins instance couldnt connect to it via browser any idea please ?
What is the error you are getting?
Can you please share the command @TheTips for docker run powershell
I did not understand the query clearly. Can you clarify it on what do you mean by command for docker run PowerShell?
where you are assing application ip in kubernetes cluster,after deployment you will showing a application in browser through ip , how to assign it
Ip address is your kubernetes ip address and port which is mapped as part of your service yaml file.
In realtime we will not use public dockerhub repo ri8??so how to specify a container in manifest file?
You use your private repository accordingly.
@@Thetips4you but how to pass credentials then?
@@ajjum6121 Save it to the credentials & use it as variable
evertything is good pls show me the properly my qus is where did you get ip address before login jenkins
It's the ip address of the machine on which you are running Jenkins. Use ip addr command.
Hi, I have this error in Kubernetes step deploy:
Caused by: hudson.remoting.ProxyException: javax.net.ssl.SSLHandshakeException: PKIX path validation failed: java.security.cert.CertPathValidatorException: Path does not chain with any of the trust anchors
Do I need to configure something in the kubernetes master node?
Did you configured the kubeconfig details in the Jenkins? Are you using minikube Or kubernetes master, nodes set up?
@@Thetips4you yes, I did copy-paste the content of config file in the /root/.kube/.
I am using kubernetes master-nodes
Is there any network issue? The error is more about proxy or ssh is not working between the system's.
Remeber, the latest version of the required plugin for the deployment to work has some issues, mainly with the Jackson API plugin included, so instead of installing that you want to install a different version. I had the same problem and i'm just about to change the newest plugin for the one used in the video
The Kubernetes continuous deploy plugin is no longer available. Is there a replacement for it?
Yes there are other kubernetes & SSH plugins.
@@Thetips4you which plug-in should I install?
@@spongeybobu other one 😀
sir I am following this tutorial but i need to deploy my app on another vm which is having kubernetes. I am getting error at the deployment stage
ERROR: ERROR: io.fabric8.kubernetes.client.KubernetesClientException: Operation: [get] for kind: [Deployment] with name: [activity-deployment] in namespace: [default] failed.
That is completely fine to deploy to a different vm. However the connection should be there to the VM and the kubeconfig is set correctly.
docker not found error in windows 10. How to run Jenkins in windows where Docker Commands work ?
You need to install docker for desktop for Windows.
@@Thetips4you I have already done. Able to solve the issue by installing Docker on Jenkins container.
Pls
Tell me is it working still ?
Hi there!. Great tutorial, however it need to be updated. Kubernetes 1.23 here. kubecfg expires after 18 hours. What is the solution for it?
You can use some job to keep updating the new config or change the expiry settings for longer period.
@@Thetips4you can you please expand on both options?
@@Thetips4you actually you can do it way simpler by using kops export kubecfg --admin=87600h
Is it still working ?
Please anyone reply
Where do we get the all the scripts for the project can’t find them any body help
Check the github. Link is in the video description.
@@Thetips4you I’m
Sorry didn’t see any link
kubernetes cd is suspended, is there a way not using the plugin?
Yes. I will update video accordingly.
hi sir. thank for your tutorial video! i followed all the steps in the tutorial and tried to deploy my app to minikube. however i got error at the deployment stage. ERROR: ERROR: io.fabric8.kubernetes.client.KubernetesClientException: An error has occurred.
hudson.remoting.ProxyException: io.fabric8.kubernetes.client.KubernetesClientException: An error has occurred. can you please tell me how to solve it? i have done some research but it doesnt work. thank u very much! ( i use the k8s cd plugin that you provided and added the k8s credentials
Are you running the Kubernetes in corporate environment behind proxy?
@@Thetips4you nah.i dont think i am using proxy and i just followed your video steps. the full output looks like this
@@Thetips4you Starting Kubernetes deployment
ERROR: ERROR: io.fabric8.kubernetes.client.KubernetesClientException: An error has occurred.
hudson.remoting.ProxyException: io.fabric8.kubernetes.client.KubernetesClientException: An error has occurred.
at io.fabric8.kubernetes.client.KubernetesClientException.launderThrowable(KubernetesClientException.java:62)
at io.fabric8.kubernetes.client.KubernetesClientException.launderThrowable(KubernetesClientException.java:53)
at io.fabric8.kubernetes.client.utils.HttpClientUtils.createHttpClient(HttpClientUtils.java:182)
at io.fabric8.kubernetes.client.BaseClient.(BaseClient.java:55)
at io.fabric8.kubernetes.client.DefaultKubernetesClient.(DefaultKubernetesClient.java:91)
at com.microsoft.jenkins.kubernetes.KubernetesClientWrapper.(KubernetesClientWrapper.java:78)
at com.microsoft.jenkins.kubernetes.KubernetesDeployContext$ClientWrapperFactoryImpl.buildClient(KubernetesDeployContext.java:466)
at com.microsoft.jenkins.kubernetes.command.DeploymentCommand$DeploymentTask.doCall(DeploymentCommand.java:141)
at com.microsoft.jenkins.kubernetes.command.DeploymentCommand$DeploymentTask.call(DeploymentCommand.java:122)
at com.microsoft.jenkins.kubernetes.command.DeploymentCommand$DeploymentTask.call(DeploymentCommand.java:105)
at hudson.FilePath.act(FilePath.java:1288)
at com.microsoft.jenkins.kubernetes.command.DeploymentCommand.execute(DeploymentCommand.java:67)
at com.microsoft.jenkins.kubernetes.command.DeploymentCommand.execute(DeploymentCommand.java:46)
at com.microsoft.jenkins.azurecommons.command.CommandService.runCommand(CommandService.java:88)
at com.microsoft.jenkins.azurecommons.command.CommandService.execute(CommandService.java:96)
at com.microsoft.jenkins.azurecommons.command.CommandService.executeCommands(CommandService.java:75)
at com.microsoft.jenkins.azurecommons.command.BaseCommandContext.executeCommands(BaseCommandContext.java:77)
at com.microsoft.jenkins.kubernetes.KubernetesDeploy.perform(KubernetesDeploy.java:42)
at com.microsoft.jenkins.azurecommons.command.SimpleBuildStepExecution.run(SimpleBuildStepExecution.java:54)
at com.microsoft.jenkins.azurecommons.command.SimpleBuildStepExecution.run(SimpleBuildStepExecution.java:35)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: hudson.remoting.ProxyException: java.nio.file.NoSuchFileException: /Users/yangmin/.minikube/ca.crt
at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:219)
at java.base/java.nio.file.Files.newByteChannel(Files.java:371)
at java.base/java.nio.file.Files.newByteChannel(Files.java:422)
at java.base/java.nio.file.Files.readAllBytes(Files.java:3206)
at io.fabric8.kubernetes.client.internal.CertUtils.getInputStreamFromDataOrFile(CertUtils.java:65)
at io.fabric8.kubernetes.client.internal.CertUtils.createTrustStore(CertUtils.java:71)
at io.fabric8.kubernetes.client.internal.SSLUtils.trustManagers(SSLUtils.java:115)
at io.fabric8.kubernetes.client.internal.SSLUtils.trustManagers(SSLUtils.java:94)
at io.fabric8.kubernetes.client.utils.HttpClientUtils.createHttpClient(HttpClientUtils.java:76)
... 23 more
[Pipeline] }
[Pipeline] // script
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: Kubernetes deployment ended with HasError
same issue buddy.... Any suggestion is very much appreciated
I cannot see any content in config file at /root/.kube
What do you see there?
@@Thetips4you I am able to see the details now. However my pipeline is failing with below error
+ script {
Script started, output log file is '{'.
jenkins@ip-172-31-8-173:~/workspace/Kubernetes Deploy$ exit
Script done.
+ dockerImage = docker.build dockerimagename
/var/lib/jenkins/workspace/Kubernetes Deploy@tmp/durable-86a54d77/script.sh: 2: dockerImage: not found
Hey it's showing docker not found
plugin is there
When you are getting docker not found?
Why am I getting this on Jenkins >> ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
Finished: FAILURE
Check branch you are using for the pipeline.
@@Thetips4you Yes it was a branch issue, however in the pipeline you must stress the repo URL and define the branch. You did not do that, but somehow it worked for you.
seems like it is depreciated and no longer working, same applies to kubernetes cli.
what a shame.
Is it. I will check for alternative.
@@Thetips4you you can firstly check to see if I’m wrong but yes with latest Kubernetes 1.24 each plugin gives error
413 Request Entity Too Large -- to deploy a plugin
When you are getting the error?
Kubernetes Continuous Deploy Plugin
Version1.0.0
A Jenkins plugin to deploy configurations to Kubernetes cluster.
Warning: The currently installed plugin version may not be safe to use. Please review the following security notices:
Missing permission checks allow enumerating credentials IDs
RCE vulnerability
CSRF vulnerability and missing permission checks allow capturing credentials
Arbitrary file read vulnerability
This plugin is deprecated. In general, this means that it is either obsolete, no longer being developed, or may no longer work
Yes you are right. The plugin seems to be obsolete.
it's 2021. it's long past time to let self hosted ci go.
jenkins hasn't been a good idea for more than a decade
Jenkins have it's own draw back and benefits. Still it is one of the highly utilized ci tool.
Not really
thanks sir i am facing this error at deploying stage and I need your help
Starting Kubernetes deployment
ERROR: ERROR: io.fabric8.kubernetes.client.KubernetesClientException: An error has occurred.
hudson.remoting.ProxyException: io.fabric8.kubernetes.client.KubernetesClientException: An error has occurred.
Is this from a specific deployment log?
Very Good Tutorial. I have ERROR. ERROR: ERROR: io.fabric8.kubernetes.client.KubernetesClientException: Operation: [get] for kind: [Pod] with name: [my-web] in namespace: [default] failed.
hudson.remoting.ProxyException: io.fabric8.kubernetes.client.KubernetesClientException: Operation: [get] for kind: [Pod] with name: [my-web] in namespace: [default] failed.
Looks like the pods are getting failed. You need to analyse more to find the root cause. Check the logs and describe options.
@Thetips4you Getting the following error in jenkins while running build
+ docker build -t thetips4you/nodeapp .
ERROR: open /certs/client/ca.pem: no such file or directory
Not sure what is the issue. Please let me know if you have any idea.
Check your docker file. I think it is looking for a certfile which you could have mentioned.
@@Thetips4you is docker already installed on jenkins container image that you are using to run jenkins ? asking since you didn't install docker on jenkins and your docker commands just run without any issue - not the case with me.
The below Error is Shown : Running on VMWare Ubuntu 22.04. Gone through articles but dint get the Proper solution. Please help me if you can
ERROR:
@Build Stage,
docker: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by docker)
At what stage are you getting this error.?
@@Thetips4you docker build stage
Here is the error and pipeline ends,
+ docker build -t sivaxxxx/k8xxd:4 .
docker: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by docker)
am getting this error in the build image stage please any idea ?
+ docker build -t xxx/nodeapp .
error: unknown command "build", see 'snap help'.
To solve this please follow the steps in the link to install jenkins container and the docker inside the jenkins container faun.pub/how-to-install-docker-in-jenkins-container-4c49ba40b373