The preparation for the CKA (Certified Kubernetes Administrator) requires lots of practice and practice. Fortunately, we have lots of online playgrounds to keep practicing, there are lots of free courseware available and lots of paid as well are available. In addition to that, we get two attempts to clear the exam
- There is training conducted by the https://training.linuxfoundation.org/ itself who conducts the CKA exams.
- But I felt this course from Udemy is good https://www.udemy.com/course/certified-kubernetes-administrator-with-practice-tests/, it has videos that explain each concept and have lots of practical sessions and mock exams.
- The https://killer.sh/ is another tool where you can practice and the questions asked in the killer.sh are complex and tests real skill. If we subscribe to the CKA exam, we will get two free sessions to solve the problems in the killer.sh
- https://www.katacoda.com/courses/kubernetes this is very useful if you are a beginner in kubernetes. It starts with a very simple usecase/scenario and we can solve in our own pace and try any number of times
- https://killercoda.com/ is another useful online tool that we can use like a playground to solve scenario-based problems
Rolling updates and rollback
• Rollout is the process of updating all the pods/replicas for a defined deployment
• Revision is a change happened in the deployment
• Deployment Strategey
○ Recreate - Destroys all the existing pod and then start creating new version of pods
○ Rolling Update - Each pod gets deleted and recreated with new version in a sequence
• Under the hood, the deployment actually creates another ReplicaSet with the new version of the image and will bring down the pods in older ReplicaSet
• For reverting the new changes, we need to execute 'kubectl rollout undo deployment/my-deployment'. Now it actually switches back to old ReplicaSet
Command and Argument
• Difference between CMD and ENTRYPOINT in docker is
○ CMD will be executed as soon as the container starts. And we can override the whole command by passing in the 'docker run'
○ ENTRYPOINT - if given, the final command that will be executed will be the concatenation of ENTRYPOINT and CMD
• We can override both of these properties in docker run command
• We can override these in kubernetes container by specifying the 'command' and 'args' fields
spec:containers:- image: ubuntucommand: ["sleep"]args: ["1000"]
Environment Variables
• We can define using the 'env' property
• We can get the env var value from ConfigMap and Secret too
spec:containers:- image: ubuntucommand: ["sleep"]args: ["1000"]env:- name: APP_COLORvalue: BLUE
ConfigMaps
• We can create using imperative and declarative way
• 2 steps
○ First we need to create the ConfigMap
○ Refer it in the POD
apiVersion: v1kind: ConfigMapmetadata:name: app-configdata:APP_COLOR: blueAPP_MODE: prodapiVersion: v1kind: podmetadata:spec:containers:- name: webappimage: webapp:v1envFrom:- configMapRef:name: app-config
Secret
• Secret are used to store sensitive information
• Can be Created in both imitative and declarative way
• In declarative way we should encode the value in base64 format
• The ConfigMap and Secret can be mounted as volume as well. In that case the properties needs to be accessed like a file /opt/app-secret-volume/DB_Host
• The value in the file should be encoded like echo -n 'root' | base64
apiVersion: v1kind: Secretmetadata:name: app-secretdata:DB_PASSWORD: hjuvhw=apiVersion: v1kind: podmetadata:spec:containers:- name: webappimage: webapp:v1envFrom:-secretRef:name: app-secretvolumes:- name: app-secret-volumesecret:secretName: app-secret
Multicontainer pod
• All the containers in the pod shares the same
○ network - accessible by localhost
○ storage
○ lefecycle
• InitContainers
○ The InitContainers are special containers which will be executed before the actual container starts
○ We can define multiple InitContainers and all of them will run in a sequence
No comments:
Post a Comment