Skip to content

Instantly share code, notes, and snippets.

@aaronkjones
Created March 25, 2021 18:03
Show Gist options
  • Save aaronkjones/109f9b11a08c2530c7b78d5ba5bd174d to your computer and use it in GitHub Desktop.
Save aaronkjones/109f9b11a08c2530c7b78d5ba5bd174d to your computer and use it in GitHub Desktop.
CKA Exam Tips

CKA Exam Tips

Exam taken Sept. 2020

Environment

  • The test environment is in Google Chrome, in a split window layout. The left side of the screen shows the question and controls; The right side, a terminal tab and instructions tab
  • You can have only one other tab open and are allowed access to Kubernetes docs and blog only
  • You'll probably want a decent sized monitor and you're able to use a secondary monitor

Resources

Helpful resources:

Editing

You will need to modify YAML quite a bit, set up your editor for it.

.vimrc

  • autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab number
  • I memoried these settings and set them at the start of the exam in $HOME/.vimrc

tmux

  • In the exam, you will work with different clusters and the question tells you what cluster to use. I used tmux tabs for each cluster
  • I vertical split my terminal window with my prompt on the left and vim open on the right

kubectl

  • You can set aliases like export kgp='kubectl get pods'
  • I recommend modifiying the shell config instead of exporting them since you might lose your terminal window

Generating YAML

  • Don't write manifests by hand, use kubectl to generate it

  • kubectl run pod nginx --image nginx:latest --port 8100 -o yaml --dry-run

      apiVersion: v1
      kind: Pod
      metadata:
      creationTimestamp: null
      labels:
          run: pod
      name: pod
      spec:
      containers:
      - args:
          - nginx
          image: nginx:latest
          name: pod
          ports:
          - containerPort: 8100
          resources: {}
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      status: {}
  • kubectl create deployment web --image nginx:latest -o yaml --dry-run

    apiVersion: apps/v1
    kind: Deployment
    metadata:
    creationTimestamp: null
    labels:
        app: web
    name: web
    spec:
    replicas: 1
    selector:
        matchLabels:
        app: web
    strategy: {}
    template:
        metadata:
        creationTimestamp: null
        labels:
            app: web
        spec:
        containers:
        - image: nginx:latest
            name: nginx
            resources: {}
    status: {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment