Giter VIP home page Giter VIP logo

ckad-practice's Introduction

CKAD exam practice questions and commands

This repo is consolidated list of ckad excersises and commands

Setup your environment to save sometime

alias k=kubectl 
k config set-context $(k config current-context) --namespace=<namespace>

If you want to setup your favorite editor

export KUBE_EDITOR=nano

Be familiar with below kubectl commands to create a pod with env variable, running on port 80, requests and limits, labels

k run mypod --image=nginx --restart=Never --port=80 --env="name=value" --requests=cpu=50m,memory=50Mi --limits=cpu=100m,memory=100Mi --replicas=1 --labels=exam=ckad --dry-run -o yaml -- /bin/bash -c 
'echo Hello; sleep 3600' 

To create a deployment with similar attributes

k run mydeploy --image=nginx  --port=80 --env="name=value" --requests=cpu=50m,memory=50Mi --limits=cpu=100m,memory=100Mi --replicas=1 --labels=exam=ckad --dry-run -o yaml -- /bin/bash -c  'echo Hello; sleep 3600'  

To create a cronjob

k run cronjob --image=nginx --labels=exam=ckad --restart=OnFailure --schedule="*/1 * * * * " -- /bin/bash -c 'echo Hello CronJob'

To create a job

k run job --image=nginx --labels=exam=ckad --restart=OnFailure -- /bin/bash -c 'echo Hello job'

To sort on a column and print only that column

 k get po -o wide --no-headers|sort -k5 -r | awk '{print $5}' ## sorting on column 5 (-r to reverse) and printing only that column
 k get po -o wide --no-headers|sort -k5 | awk '{print $5}' ## sorting on column 5 and printing only that column
 k get po -o wide --no-headers|sort -k5 |head -1| awk '{print $5}' ## sorting on column 5 and printing only that column and first one

get the container level metrics of a ngix pod having multiple containers

kubectl top pod nginx --containers

sort the events by creationtimestamp and write them to a file

kubectl get events --sort-by=.metadata.creationTimestamp > events.txt
kubectl get events -o wide |grep <podname> > pod_events_wide.txt 

Exam tip use bookmarks on your bookmark bar to quickly navigate from one topic to other

I have included my bookmarks in bookmark section for your reference

ckad-practice's People

Contributors

vishnudeevi avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.