Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to specify the Kubernetes cloud name in Jenkins agent configuration.
Jenkins
kubernetes {
cloud "[1]"
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a cloud name that does not exist in Jenkins configuration.
Confusing Docker or AWS cloud names with Kubernetes cloud.
✗ Incorrect
The Kubernetes cloud name must match the configured cloud in Jenkins, commonly named 'k8s-cloud'.
2fill in blank
mediumComplete the code to define the container template name for the Kubernetes agent.
Jenkins
containerTemplate(name: '[1]', image: 'jenkins/inbound-agent')
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using generic names that do not match the pipeline's container template.
Confusing container image name with container template name.
✗ Incorrect
The container template name is often 'worker-container' to represent the agent doing the work.
3fill in blank
hardFix the error in the pod template YAML by completing the missing field for the container image.
Jenkins
podTemplate(containers: [containerTemplate(name: 'jnlp', image: '[1]')])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using unrelated images like 'ubuntu' or 'nginx' which won't work as Jenkins agents.
Omitting the image tag causing unexpected behavior.
✗ Incorrect
The correct image for Jenkins Kubernetes agent is 'jenkins/inbound-agent:latest' to connect properly.
4fill in blank
hardFill both blanks to configure the Kubernetes agent pod with a label and a default container.
Jenkins
podTemplate(label: '[1]', defaultContainer: '[2]') { node('[1]') { stage('Build') { container('[2]') { echo 'Running build inside container' } } } }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Mismatching label and container names causing pod scheduling issues.
Using container names that do not exist in the pod template.
✗ Incorrect
The pod label is 'k8s-agent' and the default container is 'jnlp' for Jenkins Kubernetes agents.
5fill in blank
hardFill all three blanks to define a Kubernetes agent pod with a container template, label, and image.
Jenkins
podTemplate(label: '[1]', containers: [containerTemplate(name: '[2]', image: '[3]')]) { node('[1]') { stage('Test') { container('[2]') { echo 'Running tests inside container' } } } }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using mismatched labels and container names.
Using incorrect container images that do not support Jenkins agent functionality.
✗ Incorrect
The pod label is 'k8s-agent', container name is 'jnlp', and image is 'jenkins/inbound-agent:latest' for Jenkins Kubernetes agents.