Question: The Nautilus DevOps team is planning to set up a Jenkins CI server to create/manage some deployment pipelines for some of the projects. They want to set up the Jenkins server on Kubernetes cluster. Below you can find more details about the task:
1) Create namespace jenkins
2) Create a Service for jenkins deployment. Service name should be jenkins-service under jenkins namespace, type should be NodePort, targetport should be 8080 and nodePort should be 30008
3) Create a Jenkins Deployment under jenkins namespace, It should be name as jenkins-deployment , labels app should be jenkins , container name should be jenkins-container , use jenkins/jenkins image , containerPort should be 8080 and replicas count should be 1.
Make sure to wait for pods to be in running state before clicking on Finish button.
Note: The kubectl utility on jump_host has been configured to work with the kubernetes cluster.
Solution:
Create the mentioned namespace at first
kubectl create ns jenkins
Then create the service and deployment yaml according to question
vi jenkins-deployment.yaml
Apply the deployment
kubectl apply -f jenkins-deployment.yaml
Wath the pod
watch kubectl get po -n jenkins
Check the service
kubectl get svc -n jenkins
Run curl command from the pod to check the deployment
kubectl exec jenkins-deployment-6b6c78f968-7s8c4 -n jenkins -- curl http://localhost:8080
0 comments:
Post a Comment