Skip to content

Preparing effectively for the Certified Kubernetes Application Developer (CKAD) certification involves a combination of hands-on exercises and focused demo rehearsals. This certification assesses your ability to design, deploy, and manage applications on Kubernetes clusters efficiently.

Notifications You must be signed in to change notification settings

bbenameur/CKAD-hands-on-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 

Repository files navigation

CKAD-hands-on-demo

Preparing effectively for the Certified Kubernetes Application Developer (CKAD) certification involves a combination of hands-on exercises and focused demo rehearsals. This certification assesses your ability to design, deploy, and manage applications on Kubernetes clusters efficiently.

Create a new pod with the nginx image. Showing all containers running and a Readystatus

show

kubectl run nginx --image nginx
 kubectl get pods -o=jsonpath='{range .items[*]}{range .status.containerStatuses[?(@.state.running)]}{"\tContainer Name: "}{.name}{"\tRunning: "}{.state.running}{"\tReadyStatus: "}{.ready}{"\n"}{end}{end}'

Create a new service exposing the pod as a nodePort, which presents a working webserver configured in the previousstep

show

kubectl create service nodeport svc --tcp=5678:80 --dry-run -o yaml > svc.yaml
vi svc.yaml
apiVersion: v1
kind: Service
metadata:
  creationTimestamp: null
  labels:
    app: svc
  name: svc
spec:
  ports:
  - name: 5678-80
    port: 5678
    protocol: TCP
    targetPort: 80
  selector:
    run: nginx # Add run: nginx selector 
  type: NodePort
status:
  loadBalancer: {}
>ctr:x!
kubectl apply -f svc.yaml
kubectl get svc svc -o wide
NAME   TYPE       CLUSTER-IP       EXTERNAL-IP   PORT(S)          AGE   SELECTOR
svc    NodePort   10.110.220.208   <none>        5678:31030/TCP   20m   run=nginx
curl 10.110.220.208:5678 // from the same vm
curl 10.110.220.208:31030 // from the your local machine or navigator

Update the pod to run thenginx:1.11-alpineimage and re-verify you can view the webserver via a nodePort

show

kubectl edit pod nginx
 apiVersion: v1
kind: Pod
metadata:
  creationTimestamp: "2024-05-07T20:21:50Z"
  labels:
    run: nginx
  name: nginx
  namespace: default
  resourceVersion: "141816"
  uid: a7e2720e-3a8e-46bc-af6f-93e1d1b55a88
spec:
  containers:
  - image: nginx:1.11-alpine # change here
    imagePullPolicy: Always
>ctr:x!
kubectl get pod nginx
NAME    READY   STATUS    RESTARTS        AGE
nginx   1/1     Running   1 (5m53s ago)   40m
kubectl describe pod nginx
Name:             nginx
Namespace:        default
Priority:         0
Service Account:  default
Node:             ip-172-31-28-164/172.31.28.164
Start Time:       Tue, 07 May 2024 20:21:50 +0000
Labels:           run=nginx
Annotations:      <none>
Status:           Running
IP:               10.0.2.145
IPs:
  IP:  10.0.2.145
Containers:
  nginx:
    Container ID:   containerd://f9d93fb6dbd4d69d7e9de30747591d55feb95b31cd6da55ab8fcd1b8a2c6047b
    Image:          nginx:1.11-alpine // => should be the new nginx version
curl 10.110.220.208:5678 // from the same vm
curl 10.110.220.208:31030 // from the your local machine or navigator
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>

Create a job which will run a container which sleeps for three seconds then stops

show

vim job.yaml
 kubectapiVersion: batch/v1
kind: Job
metadata:
  name: my-job
spec:
  template:
    spec:
      containers:
      - name: my-container
        image: busybox
        command: ["sleep", "5"]
      restartPolicy: Never

About

Preparing effectively for the Certified Kubernetes Application Developer (CKAD) certification involves a combination of hands-on exercises and focused demo rehearsals. This certification assesses your ability to design, deploy, and manage applications on Kubernetes clusters efficiently.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published