Introduction
Prerequisites:
Kubernetes cluster and pre-prepared kubectl. Follow the Kubernetes setup guide.Step 1 – Installing Jenkins on Kubernetes
First, create a namespace :Now, create the Jenkins volume using kubectl:
kubectl apply -f volume.yaml
Next, create a ServiceAccount
with the file ServiceAccount.yaml
:
Create a ServcisAcount.yaml file for jenkins-admin clusterRole and Service Account to bind Jenkins services. The ServcisAccount.yaml file grants jenkins-admin cluster role permission to manage cluster components.
Now, create a service acount for Jenkins using kubectl:
kubectl apply -f ServcisAccount.yaml
Create a deployment-jenkins.yaml file; here, I am using the latest Jenkins image from the Docker Hub.
Now, create a deployment for Jenkins using kubectl:
Create a service.yaml file for the Jenkins service.
How to configuration notification email in jenkins
Step 2 – Jenkins WEB UI
To view the default Jenkins password, use:
Since NodePort is used for the Jenkins service, access the Jenkins dashboard using the nodeport services URL:
URL: https://ip-node-k8s:PortNodePort
Example: https://10.20.30.40:32000
Enter the default Jenkins password from the Jenkins deployment logs.
Wait for the Jenkins plugin installation steps to complete.
Select "Skip for now."
Enter the Jenkins URL into your Jenkins server address. Select "Save and Finish."
Congratulations, you have successfully set up Jenkins deployment on Kubernetes.
Conclusion
In this article, we have explored how to configure Jenkins in Kubernetes and set up Jenkins deployment on Kubernetes. When using Jenkins for CI/CD in a project, it requires plugins such as GitLab or Kubernetes to connect to GitLab or Kubernetes.
Next, refer to the comprehensive guide for Jenkins CI/CD to automate deployments and best practices using a step-by-step guide.
No comments:
Post a Comment