0
0
Jenkinsdevops~10 mins

Kubernetes agents in Jenkins - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete 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'
Ak8s-cloud
Bdocker-cloud
Clocal-cloud
Daws-cloud
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.
2fill in blank
medium

Complete 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'
Aworker-container
Bbuild-container
Ctest-container
Dagent-container
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.
3fill in blank
hard

Fix 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'
Aubuntu:latest
Bnginx:alpine
Cjenkins/inbound-agent:latest
Dbusybox
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.
4fill in blank
hard

Fill 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'
Ak8s-agent
Bjnlp
Cworker
Dbuild
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.
5fill in blank
hard

Fill 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'
Ak8s-agent
Bjnlp
Cjenkins/inbound-agent:latest
Dubuntu:20.04
Attempts:
3 left
💡 Hint
Common Mistakes
Using mismatched labels and container names.
Using incorrect container images that do not support Jenkins agent functionality.