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
Docker Storage Driver
• When we run the docker container, the docker creates another layer called as 'Container Layer' as a writable layer to store content like logs, temp file created by app or to modify the existing file. The files in the container layer will be lost when the container stops
• Commands
○ docker volume create data_volume
§ this will create a directory under /var/lib/docker/data_volume
○ docker run -v data_volume:/var/lib/mysql mysql
§ Here it mounts the volume to the
○ docker run -v data_volume2:/var/lib/docker/data_volume2
§ It creates a folder /var/lib/docker/data_volume2
○ docker run -v /data/mysql:/var/lib/mysql mysql
§ Local folder is mounted
○ docker run --mount type=bind,source=/data/mysql,target=/var/lib/mysql mysql
• Docker uses storage driver for
○ Creating the writable layered and maintaining the files in it and terminating when the container stops etc
○ There are many drivers like AUFS, ZFS, BTRFS etc
○ Docker itself will choose the best driver based on the native operating system. But we can override it
Docker Volume Driver
• Default driver is 'Local' which will use the host OS filesystem
• There are many other drivers like
○ AzureFileStorage
○ DigitalOcean
○ gce-docker
○ convoy etc
Container Interfaces
• Container Runtime Interfaces
○ Used to abstract the runtime containers like docker, rkt, cri-o etc
○ If any new runtime container support is introduced they simply have to follow the CRI docs and can implement without touching the k8s code
• Container Network Interfaces
○ Used to abstract the networking implementation used to support communication between nodes, pods etc
○ Some examples are flannel, weaveworks, cilium
• Container Storage Interfaces
○ Used to abstract the underlying storage used by using drivers like portworx, Amazon EBS, Dell EMC, Gluster FS
○ CSI is not K8S standard, it is universal standard. So if any storage vendor has the contract for CSI then it can be plugged
Volumes and Mounts
• When we create a POD, under the spec we can define the list of volumes under spec and the mounts under the containers
• There are multiple volume providers like the 'hostPath' which creates a volume in current running node. Apart from that there are many providers for it
PersistentVolume
• It allows administrator to define a different set of storage options using the persistent volume and the POD can use one of them. This gives the advantage that now each pod definition dont have to maintain all the storage configuration within itself
apiVersion: v1kind: PersistentVolumemetadata:name: pv-logspec:capacity:storage: 100MiaccessModes:- ReadWriteManyhostPath:path: /pv/log
PersistentVolumeClaim
• PVC is another k8s object created by the user with definition like requires storage size, mode etc
• Once the PVC is created the by the user, the kubernetes binds the PVC with PV
• PVC and PV are 1-1 means like only one claim can be made to a PV. Even if there are free space in PV, it cannot accommodate additional PVC
apiVersion: v1kind: PersistentVolumeClaimmetadata:name: claim-log-1spec:accessModes:- ReadWriteManyresources:requests:storage: 50MivolumeName: pv-logapiVersion: v1kind: Podmetadata:creationTimestamp: nulllabels:run: webappname: webappspec:containers:- image: kodekloud/event-simulatorname: podresources: {}volumeMounts:- mountPath: /logname: log-pvcvolumes:- name: log-volumehostPath:path: /var/log/webapp- name: log-pvcpersistentVolumeClaim:claimName: claim-log-1dnsPolicy: ClusterFirstrestartPolicy: Alwaysstatus: {}# Storage Class• Creating a PV and creating a storage type like aws, gce are called as static provisioningapiVersion: storage.k8s.io/v1kind: StorageClassmetadata:name: local-storageprovisioner: kubernetes.io/no-provisionervolumeBindingMode: WaitForFirstConsumerapiVersion: v1kind: PersistentVolumemetadata:name: local-pvspec:capacity:storage: 500MiaccessModes:- ReadWriteOncehostPath:path: /opt/vol1storageClassName: local-storageapiVersion: v1kind: PersistentVolumeClaimmetadata:name: local-pvcspec:accessModes:- ReadWriteOnceresources:requests:storage: 500MistorageClassName: local-storageapiVersion: v1kind: Podmetadata:creationTimestamp: nulllabels:run: nginxname: nginxspec:containers:- image: nginx:alpinename: nginxresources: {}volumeMounts:- mountPath: "/var/www/html"name: volume-htmlvolumes:- name: volume-htmlpersistentVolumeClaim:claimName: local-pvcdnsPolicy: ClusterFirstrestartPolicy: Always
No comments:
Post a Comment