• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 2 out of 11 pages
Exam (elaborations)

CKAD Code Examples Questions with Solutions

Document preview thumbnail
Preview 2 out of 11 pages

Exam of 11 pages for the course CKAD at CKAD (CKAD Code Examples)

Content preview

CKAD Code Examples


Equality-based label requirement - answer=,==,!=

Set-based label requirements - answerin,notin,exists

kubectl imperative cmds - answerscale, annotate, label, set <field>, edit, patch

Using --edit to modify objects before creation - answerkubectl create --edit -f
/tmp/srv.yaml

configuration file for a Pod that has the annotation imageregistry:
https://hub.docker.com/ - answerapiVersion: v1 kind: Pod metadata: name: annotations-
demo annotations: imageregistry: "https://hub.docker.com/" spec: containers: - name:
nginx image: nginx:1.14.2 ports: - containerPort: 80

https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/

Field selectors, ex: filter pods by name "foo" + status.phase "Pending" - answerlet you
select Kubernetes resources based on the value of one or more resource fields with
equality ops & can chain with comma-seperated

ex: kubectl get pods --field-selector metadata.name=foo,status.phase=Pending

Deployment that creates ReplicaSet w/ 3 nginx Pods - answerapiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:

, - name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80

https://kubernetes.io/docs/concepts/workloads/controllers/deployment/

main parts: replicas, selector, template

create Job with command, Never restart policy, 4 retrys, 3 completions, 2 parallel runs,
finish in 5s - answerapiVersion: batch/v1
kind: Job
metadata:
name: pi
spec:
template:
spec:
containers:
- name: pi
image: perl
command: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"]
restartPolicy: Never
backoffLimit: 4
completions: 3
parallelism: 2
activeDeadlineSeconds: 5

main parts: spec.template.spec.containers, command, restartPolicy, backoffLimit,
activeDeadlineSeconds

https://kubernetes.io/docs/concepts/workloads/controllers/job/#running-an-example-job

create CronJob w/ arg & print time every minute - answerapiVersion: batch/v1beta1
kind: CronJob
metadata:
name: hello
spec:
schedule: "*/1 * * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: hello
image: busybox
args:

Document information

Uploaded on
August 7, 2024
Number of pages
11
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers
$16.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
Dreamer252
4.0
(117)
Sold
497
Followers
297
Items
21575
Last sold
2 months ago




Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions