Set up complete CI/CD Jenkins pipeline for kubernetes - Part 11
ฝัง
- เผยแพร่เมื่อ 26 ก.ย. 2024
- ==================================
CI/CD Pipelines Kubernetes- jhooq.com/ci-c...
Setting up a Kubernetes cluster using Kubespray - jhooq.com/kube...
==================================
In this session on "CI/CD Kubernetes | Setting up CI/CD Jenkins pipeline for Kubernetes" we are going to see
1. As a first step we are going to set up the Kubernetes cluster using Kubespray
2. We will be using Spring Boot Application as our base application
3. Jenkins - We need to install Jenkins on one of the servers
4. After that we need to fetch the initial admin password and set the admin user
5. Install the default plugins for Jenkins
6. We will be needing Gradle for compiling the java application
7. Docker - Install docker on alongside Jenkins
8. You also need Docker Hub Account
9. Finally we are going to pull the latest image from DockerHub and going to deploy inside the Kubernetes cluster
To read more about Kubernetes - kubernetes.io/
To read more about Jenkins - www.jenkins.io/
For more similar content follow up on - jhooq.com
Disclaimer/Policy: All the content/instructions are solely mine. The source is completely open-source.
Video is copyrighted and it can not be re-distributed on any platform.
Fabulous.. tested and verified the job at home VM... works in a very smooth way .. Thanks for sharing the videos. Great work .. !!!!!
Glad it helped you to learn something new
Crystal clear explanation..🤝🤝
I haven't seen anyone explaining this clear..
Glad you liked it.
Apart from the great explanation, I truly appreciate for such a wonderful documentation which most tutors don't do. This is outstanding and the BEST one ever i have seen. Thanks a million.
This is the most explanatory video I've come across on TH-cam. Kudos!!!
It is nice and useful session for hands on experience.. thanks for efforts
It's my pleasure
you are a guru Rahul.. Your finesse in delivery is awesome. Thank you
Thank you sooo much. Its a clear explanation and more practical Knowledge. It is very helpful for me to setup these environment..Kudoos🙏🙏
Really useful.....Thanks a lot...............
Great work every steps u explained clearly thanks for the awesome video keep uploading thanks rahul
So nice of you
The Best Step-by-Step pod deployment from ground zero into K8 Cluster. I loved the pace of this tutorial.
Rahul, you are awesome. Thank you and my gratitude and appreciation for your time posting this.
Glad you liked it.
There are more similar session i am planning to upload in upcoming weeks. May be you can checkout the latest lab session on terraform - th-cam.com/video/jJX6S5JAGpI/w-d-xo.html
//Rahul
Thank you very very much for this precious information and practical knowledge, really appreciated your work, Sir. God bless you!!!🙏
very well explained thanks for your efforts and time.
Great work keep it up. Love from Pakistan
Keep learning
Thank you for this video. This video is pretty much informative .
Glad you enjoyed it! There is more coming on jenkins in upcoming weeks
Really very nice and clear iformation
You welcome
Thank you so much for putting so much effort in explaining things which is very useful every one who is on thrust of getting knowledge on the technology, keep Good ,Thanks Again
Glad it was helpful!
Millions of thanks to you brother
You welcome
very well explained 👏🏻. you should create more video for the same but with AWS, where you use AWS ECR instead of docker and EKS for kube cluster. this would really be helpful for ppl who are planning to setup ci/cd for their company.
The video is already there on my channel. If you haven't got chance to look at it - th-cam.com/video/ENNBdmNn4r0/w-d-xo.html
@@RahulWagh thanks rahul. keep up the good work.
excellent Bro am watching all from helm to jenkin i can understand easily
Was in search of this, good job Rahul Bhai.
Awesome session. Thank you Rahul for such a useful session and patience is really appreciated.
Great session.
You are welcome
clear explanation .Thanks you
You are welcome
Great DevOps Session. Enjoyed it !!! Thanks.
Best tutorial on DevOps project !!!
Thank you sir
Glad you liked it!
Superb Explanation
Thank you 🙂
Awesome Video. Got clear clarity on pipeline and kube deployments.
Great to hear!
#ThanksRahul, really appreciated your work and time and Subscribing...
You welcome
Appreciate your efforts on content creation. Great job
I appreciate that!
Session is great! 🔥 but I would suggest to look for Kaniko project, it helps building container image inside k8s cluster itself instead of Jenkins server.
Thanks for the tip!
Very nicely covered each steps, thanks Rahul for this awesome study guide
So nice of you
@@RahulWagh please share me git hub link where they have written the code like docker file and kubernates deployment file
Thank you very much, brother ... you are a real super human
Ohh thanks I hope it helped you
Great step by step explanation i loved it thanks
Glad it was helpful!
Very well explained...Excellent tutorial
Glad you liked it
Great Content.....looking for more such real time scenarios vedios in future. 👏
Till now i was learning tools individually ...but after watching this many other concepts also cleared.
Stay tuned there are more to come
Excellent
awesome Sir, Thanks a lot.... i have followed step by step and working for me
but i have done it without vagrant...in windows virtualbox environment
Glad it helped!
Fantastic Tutorial, Great job man!!
Cheers!
great content
You are welcome
Awesome!!, Thanks for this insight
You welcome
I like style and way of presentation :):)
Happy to hear that!
Cannot wait for watching this video :)
Its long one but I hope you will like it
Hello Rahul, Its nice video, I have impelement here but I stucked at last 2nd last step that to copy yaml file to k8s cluster.its giving error that auth fail. Can you suggest what to do?
good to see this , i like this
I hope you enjoyed the session
@@RahulWagh yes really , and also clear the points
After giving Buildnow its showing BuildSheduled but not Building anything in Jenkins. Please help
Hi Rahul,
I am getting error when I am doing this stage put k8s-spring-boot-deployment.yaml onto instance-1
This is the error I am getting
SSH steps: sshPut - put a file/directory on remote node.
Can you please tell me where I have done wrong
Thank you again for the great content.. Have you got a video that shows how to deploy helm chart to a repo using jenkins??
@Joe b. You are welcome and regarding your question on “Deploy helm chart to a repo using Jenkins”? - so not yet but it’s on my list. Stay tuned I have lot more on helm chart which I will be uploading
//Rahul
sir why did u started pipeline with "node { " the syntax for pipeline starts from "pipeline { " no ? and also havent used "steps" inside stage . what is the reason behind it please? or this is a new type of syntax ?
Can you posible to create one video to create a Mysql microservice in Kubernetes and access this SQL using SQL workbench in the AWS EKS
Dear Sir, Why VAGRANT when jenkins can be installed in few steps
yum install jenkins. systemctl start, systemctl enable, firewall exception etc.?
Can we deploy direct in clusters, without master-node , Like eks cluster
Great Video
Thanks for the visit
Thank you
You're welcome
Nice explained Rahul.. Thanks.. I just need to know how to change the hello message if i need own message instead of "Hello - Jhooq-k8s i Have updated the message" Please suggest
Hi Deepak, Here is the GitHub link of my project - github.com/rahulwagh/spring-boot-docker
You can clone the gitrepo and make the changes in the message by editing code- github.com/rahulwagh/spring-boot-docker/blob/master/src/main/java/com/jhooq/Jhooqk8s/ws/JhooqDockerDemoController.java
Then you need to build a docker image and push the updated docker to image docker hub and then you can follow rest of the steps as explained in the lab session
//Rahul
@@RahulWagh i did the same but not working..getting same msg again
for this we need 3servers 1)is for jenkins 2)k8s master and 3)k8s node
Yes that is correct
@@RahulWagh 1)one server is for jenkins 2)server is for k8s master 3) server is for k8s node total 3servers
Thank you very much. I have one doubt, can I do this process with out 3rd step ( gradle).
Well I this setup I have used spring boot Java applications and gradle is the build tool I have chosen.
But in case if you have different app like node.ja or angular or even if you are using maven for ja a then you can exclude the step
But if you are trying to exercise the same project then you can not do it without 3rd step (gradle)
Thanks
I want to know the Deploy details. Usually, will happen on Production server or Testing server. Can we do it deployment on Production server as it's running 24/7.
Please clarify.
Why you not showing tutorial on VM workstation?
sir following ur tutorila.but stuck in very 1st stage of the pipeline.below error is showing.
error: could not find any revision to build.verify the repository and branch configuration for this job.finished failure
There seems to be a problem with Git URL, how you are putting the GIT URL or how your git URL looks like ?
//Rahul
Very nice. 👌👌👌
Glad you liked it, stay tuned for further more
I have installed Kops for kubernetes master and workernode in AWS ec2. What is the username and password i need give in this step -> SSH Into k8smaster server.
Sir make videos on jenkins
Sure I will do in future
how to configure ssh pipeline plugin details
Can you please prepare a demo explaining the versioning concept with Git & Jenkins in the same pipeline. Thank you.
surely but i can not edit the same video since youtube does not allow you to edit video once it is published. So probably i can include versioning, git and jenkins in some other video
@@RahulWagh thank you 🙏
How to pull image from private docker registry on jenkins
You need to do docker login and then use docker pull from private repo
Hi it was great video, i was wondering to know how to Test in jenkins pipeline.
Are you referring to junit test ?
Hi Rahul..I saw one of ur comments in Jackson 2 issue in Jenkins file while deploying to kubernetes.. By any chance did u find any solution for the same other than downgrading Jackson.. unfortunately I'm in same situation..if you could help me it would be greatful..
Hi Anoop,
I has that issue but I found a work around and used *SSH Pipeline Steps* plugin available for jenkins, so that i can do ssh login from my jenkins instance.
I spent soo much time on that jackson 2 issue but could not find good solution. But if you have choice of going for SSH Pipeline steps plugin then go for it because jackson 2 error was so much annoying and its hard to fix because lack community support and documentation.
If somehow you manage to make it fix, it will pop up in upcoming versions of jenkins.
//Rahul
sir gradle build is taking too much time. its not happening quickly as shown in your tutorial. the buiild is not completing . its been 20mins. what to do please?
It takes for the first time but it will be faster in the next build, for me also it took a lot of time so cut short the video because it’s boring to show that part
@@RahulWagh thanks for ur reply sir
Hi sir, everuthing fine but last pushing the yaml to k8's master getting this error
groovy.lang.MissingPropertyException: No such property: remote for class: groovy.lang.Binding
at groovy.lang.Binding.getVariable(Binding.java:63)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:271) could you please help me why this error getting
Hi Rahul,
Could you please help me here, I am getting the below error while building using gradle.
What went wrong:
Execution failed for task ':compileJava'.
> Could not target platform: 'Java SE 11' using tool chain: 'JDK 8 (1.8)'.
There seems to be problem of different JDK version. I think you are using 8 and planning to setup up the jenkins pipeline with jdk 11.
It helps, Thanks!!!
Hi Rahul,
Can we perform this tutorial on Windows 10?
Yes off course you can do it on windows you need to install vagrant and virtualbox
Thank you! But I got this error "Could not target platform: 'Java SE 11' using tool chain: 'JDK 8 (1.8)'." when I run ./gradlew build Any idea?
You are trying to use two versions of Java which is jdk 8 and jdk 11. It will cause this type of issues. So please use only single Java either 11 or 8
@@RahulWagh Thanks. I try to add tools JDK11 on stage Gradle Build. Looks like problem solved. But the Pipeline will hang on compileJava, before that, I can see "Cannot contact default-kzvv7: java.lang.InterruptedException" Any problem on my jenkins? I use default jnlp container Template. and gradle 7.2
Hi Rahul getting this error for gradle build second stage " ./gradlew build
/var/lib/jenkins/workspace/spring-boot-application@tmp/durable-7ca9dba9/script.sh: 1: /var/lib/jenkins/workspace/spring-boot-application@tmp/durable-7ca9dba9/script.sh: ./gradlew: Permission denied" please help me
I think your jenkins user is not able to execute the gradlew build that is why you are getting permission denied issue.
Error comes when gradle build
dep@tmp/durable-239d3d4d/script.sh: ./gradlew: Permission denied
ERROR: script returned exit code 127
I give all permissions to jenkins user(sudo access)and that folder , but error still their.
Help please.
please check whether the ./gradlew is executable or not. What i mean is something ./gradlew is only in RW mode but not in X mode.
So i would recommend to change its mode the executable example - chmod +x gradlew and then try again
Thanks alot for very informative tutorial. One question if you can help. I am pulling repository from scm server instead of git. what command should i use?
git credentialsId: 'GIT_CREDENTIALS',
is not working for scm/svn server
Thanks
Are you using mercury or svn ?
Hi
Rahul, thank you very much for the Demo. It is #AWSomeness....!!!
Can you please demo the same using AWS instead of a local machine
Thanks in advance!
Hey sello you are most welcome.
It’s on my calendar as soon as I get time I will prepare it stay tuned there are more to come.
//Rahul
Hi,
Can you please provide some more details on terraform .. how we are using in Azure ..
Thanks!
Yes, sure I am planning add more on terrafrom azure and google cloud in upcoming weeks
Please make a video same thing on aws
surely i will try to preparing something similar on aws
Ok thanks rahul
Is there any other method to deploy the application on kubernetes cluster other than using scriptive pipeline ?
Yes you can create jenkins file and write some groovy script to implement the same
Okay, Thank you
Can't we use any other approach rather than ssh to node
There are some kubernetes plugins for Jenkins but those plugins seems to buggy and not actively maintained by community
Hi Rahul, If i use EKS cluster what should be my remote name,host,user and pwd?
In which step you are?
Are you trying to setup username and password inside Jenkins step? Or somewhere else?
@@RahulWagh last stage "ssh to K8S server
Do u have any blog or video on how to set up pipeline using jenkins to eks
Not yet on EKS
You need to use your actual host/ip along with right credentials
Can we download this video?
Hi Lakshman i am afraid to say but you can not download the video.
But you can view as many time as you can and it should be available in around 48 mins from now
Help
HI Rahul,
actually its take too much time got build gradle as I am using 1 gb memory thorugh AWS can you please help or better to be share your email so that will coordinate
You can send me a email on - rahul.wagh17@gmail.com
@@RahulWagh mail has been sent to you
Here is my 2 cents after going through your mail -
The first build always takes time because gradle is trying to download the dependencies for the first time but the later build should be quick because of the gradle cache.
But one more point which strikes in my mind is the node on which you are running Jenkins, maybe you have allocated less memory to it. Try increasing the memory on which your Jenkins is running.
Always keep in mind Gradle is a memory heavy process so it might cause little lag.
The logs from your screenshot looks quite good - so try increasing your memory on Jenkins nodes as well as be patient with the first Gradle build.
Hello Sir I have faced an issue with the Gradle build part, the error is provided here.
mpositeBuildSettingsLoader.java:35)
at org.gradle.initialization.DefaultSettingsPreparer.prepareSettings(DefaultSettingsPreparer.java:36)
at org.gradle.initialization.BuildOperatingFiringSettingsPreparer$LoadBuild.doLoadBuild(BuildOperatingFiringSettingsPreparer.java:59)
at org.gradle.initialization.BuildOperatingFiringSettingsPreparer$LoadBuild.run(BuildOperatingFiringSettingsPreparer.java:54)
Sir is it better to keep IAC-Vagrant separate session for the same work carried out manually.
I use vagrant so that I can destroy the session VM after the use but you can use the same instructions irrespective of vagrant or directly on the machine
Great work, nice demonstration
Thanks for the feedback!