{"id":97142,"date":"2024-08-16T12:47:41","date_gmt":"2024-08-16T07:17:41","guid":{"rendered":"https:\/\/www.whizlabs.com\/blog\/?p=97142"},"modified":"2024-08-16T12:47:41","modified_gmt":"2024-08-16T07:17:41","slug":"certified-kubernetes-administrator-exam","status":"publish","type":"post","link":"https:\/\/www.whizlabs.com\/blog\/certified-kubernetes-administrator-exam\/","title":{"rendered":"Top 20 Questions To Prepare For Certified Kubernetes Administrator Exam"},"content":{"rendered":"<p><span style=\"font-weight: 400;\">The <\/span><a href=\"https:\/\/www.whizlabs.com\/certified-kubernetes-administrator\/\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">Certified Kubernetes Administrator (CKA)<\/span><\/a><span style=\"font-weight: 400;\"> certification is an essential credential for those aiming to excel in working with containers and managing cloud-native applications on Kubernetes. In this blog, we\u2019ll walk you through the top 20 CKA certification questions to give you a solid understanding of what the exam covers.<\/span><\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_76 ez-toc-wrap-left counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #ea7e02;color:#ea7e02\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #ea7e02;color:#ea7e02\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.whizlabs.com\/blog\/certified-kubernetes-administrator-exam\/#The_Certified_Kubernetes_Administrator_Exam_Things_To_Remember\" >The Certified Kubernetes Administrator Exam: Things To Remember\u00a0<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.whizlabs.com\/blog\/certified-kubernetes-administrator-exam\/#Top_20_CKA_certification_questions\" >Top 20 CKA certification questions<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.whizlabs.com\/blog\/certified-kubernetes-administrator-exam\/#1_Creating_a_Service_Account_with_Cluster-Wide_Pod_Listing_Permissions\" >1. Creating a Service Account with Cluster-Wide Pod Listing Permissions<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.whizlabs.com\/blog\/certified-kubernetes-administrator-exam\/#2_Creating_and_Upgrading_a_Deployment_with_Version_Annotations\" >2. Creating and Upgrading a Deployment with Version Annotations<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.whizlabs.com\/blog\/certified-kubernetes-administrator-exam\/#3_Creating_a_Snapshot_of_a_MySQL_Database_and_Saving_it_to_a_File\" >3. Creating a Snapshot of a MySQL Database and Saving it to a File<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.whizlabs.com\/blog\/certified-kubernetes-administrator-exam\/#4_Creating_a_Persistent_Volume_with_Specific_Specifications\" >4. Creating a Persistent Volume with Specific Specifications<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.whizlabs.com\/blog\/certified-kubernetes-administrator-exam\/#5_Tainting_a_Node_and_Managing_Pod_Scheduling_with_Taints_and_Tolerations\" >5. Tainting a Node and Managing Pod Scheduling with Taints and Tolerations<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.whizlabs.com\/blog\/certified-kubernetes-administrator-exam\/#6_Draining_a_Node_and_Rescheduling_Pods_to_Other_Nodes\" >6. Draining a Node and Rescheduling Pods to Other Nodes<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.whizlabs.com\/blog\/certified-kubernetes-administrator-exam\/#7_Creating_a_Pod\" >7. Creating a Pod\u00a0<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/www.whizlabs.com\/blog\/certified-kubernetes-administrator-exam\/#8_Creating_a_NetworkPolicy_to_Deny_All_Egress_Traffic\" >8. Creating a NetworkPolicy to Deny All Egress Traffic<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/www.whizlabs.com\/blog\/certified-kubernetes-administrator-exam\/#9_ClusterRole_and_ClusterRole_Binding\" >9. ClusterRole and ClusterRole Binding<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/www.whizlabs.com\/blog\/certified-kubernetes-administrator-exam\/#10_Node_Maintenance_and_Pod_Rescheduling\" >10. Node Maintenance and Pod Rescheduling<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/www.whizlabs.com\/blog\/certified-kubernetes-administrator-exam\/#11_KUBEADM_Cluster_Setup\" >11. KUBEADM Cluster Setup<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/www.whizlabs.com\/blog\/certified-kubernetes-administrator-exam\/#12_KUBEADM_Cluster_Upgrade\" >12. KUBEADM Cluster Upgrade<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/www.whizlabs.com\/blog\/certified-kubernetes-administrator-exam\/#13_ETCD_Backup_Restore_with_Data_Verification\" >13. ETCD Backup &amp; Restore with Data Verification<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/www.whizlabs.com\/blog\/certified-kubernetes-administrator-exam\/#14_Network_Policies\" >14. Network Policies<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-17\" href=\"https:\/\/www.whizlabs.com\/blog\/certified-kubernetes-administrator-exam\/#15_Scale_Deployments\" >15. Scale Deployments<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-18\" href=\"https:\/\/www.whizlabs.com\/blog\/certified-kubernetes-administrator-exam\/#16_Multi-Container_Pods\" >16. Multi-Container Pods<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-19\" href=\"https:\/\/www.whizlabs.com\/blog\/certified-kubernetes-administrator-exam\/#17_Ingress_Resource\" >17. Ingress Resource<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-20\" href=\"https:\/\/www.whizlabs.com\/blog\/certified-kubernetes-administrator-exam\/#18_POD_and_Logging\" >18. POD and Logging<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-21\" href=\"https:\/\/www.whizlabs.com\/blog\/certified-kubernetes-administrator-exam\/#19_NodeSelector\" >19. NodeSelector<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-22\" href=\"https:\/\/www.whizlabs.com\/blog\/certified-kubernetes-administrator-exam\/#20_Resource_Requests_and_Limits\" >20. Resource Requests and Limits<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-23\" href=\"https:\/\/www.whizlabs.com\/blog\/certified-kubernetes-administrator-exam\/#Kubernetes_Exam_Preparation_Tips\" >Kubernetes Exam Preparation Tips<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-24\" href=\"https:\/\/www.whizlabs.com\/blog\/certified-kubernetes-administrator-exam\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"The_Certified_Kubernetes_Administrator_Exam_Things_To_Remember\"><\/span><span style=\"font-weight: 400;\">The Certified Kubernetes Administrator Exam: Things To Remember\u00a0<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">The <\/span><span style=\"font-weight: 400;\">Certified Kubernetes Administrator Ex<\/span><span style=\"font-weight: 400;\">am teaches how to create, deploy, and manage Kubernetes best practices and clusters. Here are a few things you need to remember about the Certified Kubernetes Administrator Exam:\u00a0<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">The exam will cost $395 and includes one retake free of cost if you fail the exam on the first attempt or face any issues with the browser.\u00a0<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">It is a problem-based exam, and you will solve those problems using the command line interface.\u00a0<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">The exam is two hours long, and you need to solve 17 questions. The passing mark is 66%, and each question has a specific weight.\u00a0<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Some questions will be multiple questions. If you can attempt to get a few parts correct, you will have them added to your final score. This means you will benefit from the step marking.\u00a0<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">The certification is valid for three years. It\u2019s an open-book exam, so you will be given access to these materials:<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><a href=\"https:\/\/kubernetes.io\/docs\/\" target=\"_blank\" rel=\"nofollow noopener\"><span style=\"font-weight: 400;\">https:\/\/kubernetes.io\/docs\/<\/span><\/a><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><a href=\"https:\/\/kubernetes.io\/blog\/\" target=\"_blank\" rel=\"nofollow noopener\"><span style=\"font-weight: 400;\">https:\/\/kubernetes.io\/blog\/<\/span><\/a><\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"Top_20_CKA_certification_questions\"><\/span><span style=\"font-weight: 400;\">Top 20 CKA certification questions<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Here are a few sample questions to help you level up your preparations and better understand the Certified Kubernetes Administrator certification. These questions are mostly performance-based, and you must work with a live Kubernetes cluster to complete the task.\u00a0<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"1_Creating_a_Service_Account_with_Cluster-Wide_Pod_Listing_Permissions\"><\/span><span style=\"font-weight: 400;\">1. Creating a Service Account with Cluster-Wide Pod Listing Permissions<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Create a new service account named `logviewer`. Grant this service account access to list all Pods in the cluster by creating an appropriate cluster role called `podviewer-role` and a `ClusterRoleBinding` called `podviewer-role-binding`.<\/span><\/p>\n<h4><span style=\"font-weight: 400;\">Answer<\/span><\/h4>\n<p><b>Create the Service Account<\/b><\/p>\n<p><span style=\"font-weight: 400;\">First, create a YAML file named `logviewer-sa.yaml` for the service account:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0&#8220;`yaml<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0apiVersion: v1<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0kind: ServiceAccount<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0metadata:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0name: logviewer<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0namespace: default<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0&#8220;`<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0Apply this YAML file using `kubectl`:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0&#8220;`bash<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0kubectl apply -f logviewer-sa.yaml<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0&#8220;`<\/span><b>Create the ClusterRole:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Next, create a YAML file named `podviewer-role.yaml` for the ClusterRole:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0&#8220;`yaml<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0apiVersion:<\/span><a href=\"http:\/\/rbac.authorization.k8s.io\/v1\" target=\"_blank\" rel=\"nofollow noopener\"> <span style=\"font-weight: 400;\">rbac.authorization.k8s.io\/v1<\/span><\/a><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0kind: ClusterRole<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0metadata:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0name: podviewer-role<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0rules:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0&#8211; apiGroups: [&#8220;&#8221;]<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0resources: [&#8220;pods&#8221;]<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0verbs: [&#8220;list&#8221;]<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0&#8220;`<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Apply this YAML file using `kubectl`:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0&#8220;`bash<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0kubectl apply -f podviewer-role.yaml<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0&#8220;`<\/span><\/p>\n<p><b>Create the ClusterRoleBinding<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Finally, create a YAML file named `podviewer-role-binding.yaml` for the ClusterRoleBinding:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0&#8220;`yaml<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0apiVersion:<\/span><a href=\"http:\/\/rbac.authorization.k8s.io\/v1\" target=\"_blank\" rel=\"nofollow noopener\"> <span style=\"font-weight: 400;\">rbac.authorization.k8s.io\/v1<\/span><\/a><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0kind: ClusterRoleBinding<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0metadata:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0name: podviewer-role-binding<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0subjects:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0&#8211; kind: ServiceAccount<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0name: logviewer<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0namespace: default<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0roleRef:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0kind: ClusterRole<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0name: podviewer-role<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0apiGroup:<\/span><a href=\"http:\/\/rbac.authorization.k8s.io\" target=\"_blank\" rel=\"nofollow noopener\"> <span style=\"font-weight: 400;\">rbac.authorization.k8s.io<\/span><\/a><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0&#8220;`<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0Apply this YAML file using `kubectl`:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0&#8220;`bash<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0kubectl apply -f podviewer-role-binding.yaml<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0&#8220;`<\/span><\/p>\n<h4><span style=\"font-weight: 400;\">Explanation:<\/span><\/h4>\n<p><b>Service Account (logviewer):<\/b><span style=\"font-weight: 400;\"> This account will be used to interact with the Kubernetes API.<\/span><\/p>\n<p><b>ClusterRole (podviewer-role) defines the<\/b><span style=\"font-weight: 400;\"> resources and actions the logviewer service account can perform. In this case, it can list Pods.<\/span><\/p>\n<p><b>ClusterRoleBinding (podviewer-role-binding): <\/b><span style=\"font-weight: 400;\">This binds the logviewer service account to the podviewer-role, granting it the specified permissions.<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"2_Creating_and_Upgrading_a_Deployment_with_Version_Annotations\"><\/span><span style=\"font-weight: 400;\">2. Creating and Upgrading a Deployment with Version Annotations<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Create a new deployment called <\/span><span style=\"font-weight: 400;\">webserver-deploy<\/span><span style=\"font-weight: 400;\"> with the image <\/span><span style=\"font-weight: 400;\">httpd:2.4<\/span><span style=\"font-weight: 400;\"> and 2 replicas. Record the version in the annotations. Next, upgrade the deployment to version <\/span><span style=\"font-weight: 400;\">httpd:2.6<\/span><span style=\"font-weight: 400;\"> using a rolling update. Ensure that the version upgrade is recorded in the resource annotations.<\/span><\/p>\n<h4><span style=\"font-weight: 400;\">Answer<\/span><\/h4>\n<p><b>Create the Initial Deployment:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Create a YAML file named webserver-deploy-v1.yaml for the deployment:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">apiVersion: apps\/v1<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kind: Deployment<\/span><\/p>\n<p><span style=\"font-weight: 400;\">metadata:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0name: webserver-deploy<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0annotations:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0version: &#8220;2.4&#8221;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">spec:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0replicas: 2<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0selector:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0matchLabels:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0app: webserver<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0template:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0metadata:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0labels:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0app: webserver<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0spec:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0containers:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8211; name: httpd<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0image: httpd:2.4<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0ports:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8211; containerPort: 80<\/span><\/p>\n<p><b>Apply this YAML file using kubectl:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">kubectl apply -f webserver-deploy-v1.yaml<\/span><\/p>\n<p><b>Upgrade the Deployment to Version httpd:2.6:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Update the deployment YAML file to the new version. Create a new YAML file named webserver-deploy-v2.yaml:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">apiVersion: apps\/v1<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kind: Deployment<\/span><\/p>\n<p><span style=\"font-weight: 400;\">metadata:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0name: webserver-deploy<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0annotations:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0version: &#8220;2.6&#8221;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">spec:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0replicas: 2<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0selector:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0matchLabels:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0app: webserver<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0template:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0metadata:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0labels:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0app: webserver<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0spec:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0containers:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8211; name: httpd<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0image: httpd:2.6<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0ports:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8211; containerPort: 80<\/span><\/p>\n<p><b>Apply this updated YAML file using kubectl:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">kubectl apply -f webserver-deploy-v2.yaml<\/span><\/p>\n<h4><span style=\"font-weight: 400;\">Explanation:<\/span><\/h4>\n<p><b>Initial Deployment (webserver-deploy with httpd:2.4): <\/b><span style=\"font-weight: 400;\">This creates a deployment with 2 replicas running the httpd:2.4 image and includes an annotation to record the version.<\/span><\/p>\n<p><b>Deployment Upgrade:<\/b><span style=\"font-weight: 400;\"> The deployment is updated to use the httpd:2.6 image, and the version annotation is updated to reflect this change.<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"3_Creating_a_Snapshot_of_a_MySQL_Database_and_Saving_it_to_a_File\"><\/span><span style=\"font-weight: 400;\">3. Creating a Snapshot of a MySQL Database and Saving it to a File<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Create a snapshot of the MySQL database running on localhost:3306. Save the snapshot into \/var\/backups\/mysql-snapshot.sql.<\/span><\/p>\n<h4><span style=\"font-weight: 400;\">Answer:<\/span><\/h4>\n<p><b>Ensure MySQL is Running:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Ensure the MySQL server is running and you have the necessary permissions to create a backup.<\/span><\/p>\n<p><b>Create the Snapshot:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Use the mysqldump command to create a snapshot of the MySQL database. You need to specify the database name you want to back up. For example, if your database is named mydatabase, you can create a snapshot with the following command:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">mysqldump -h localhost -P 3306 -u yourusername -p mydatabase &gt; \/var\/backups\/mysql-snapshot.sql<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">-h localhost: Specifies the host where MySQL is running.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">-P 3306: Specifies the port where MySQL is listening.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">-u yourusername: Specifies the MySQL username.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">-p: Prompts for the MySQL password.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">mydatabase: The name of the database to back up.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">&gt; \/var\/backups\/mysql-snapshot.sql: Redirects the output to the specified file path.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Verify the Snapshot:<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Ensure the snapshot file \/var\/backups\/mysql-snapshot.sql has been created and contains the data.<\/span><\/p>\n<h4><span style=\"font-weight: 400;\">Explanation:<\/span><\/h4>\n<p><b>Database Snapshot: <\/b><span style=\"font-weight: 400;\">This process creates a backup of the specified MySQL database and saves it as an SQL file, which can be used for restoration or migration purposes.<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"4_Creating_a_Persistent_Volume_with_Specific_Specifications\"><\/span><span style=\"font-weight: 400;\">4. Creating a Persistent Volume with Specific Specifications<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Create a Persistent Volume with the following specifications:<\/span><\/p>\n<p><b>Name<\/b><span style=\"font-weight: 400;\">: data-volume<\/span><\/p>\n<p><b>Capacity<\/b><span style=\"font-weight: 400;\">: 10Gi<\/span><\/p>\n<p><b>Access Modes<\/b><span style=\"font-weight: 400;\">: ReadWriteOnce<\/span><\/p>\n<p><b>Storage Class:<\/b><span style=\"font-weight: 400;\"> fast-storage<\/span><\/p>\n<p><b>Host Path<\/b><span style=\"font-weight: 400;\">: \/mnt\/data<\/span><\/p>\n<h4><span style=\"font-weight: 400;\">Answer\u00a0<\/span><\/h4>\n<p><b>Create the Persistent Volume YAML File:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Create a file named data-volume-pv.yaml with the following content<\/span><\/p>\n<p><span style=\"font-weight: 400;\">apiVersion: v1<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kind: PersistentVolume<\/span><\/p>\n<p><span style=\"font-weight: 400;\">metadata:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0name: data-volume<\/span><\/p>\n<p><span style=\"font-weight: 400;\">spec:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0capacity:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0storage: 10Gi<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0accessModes:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8211; ReadWriteOnce<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0storageClassName: fast-storage<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0hostPath:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0path: \/mnt\/data<\/span><\/p>\n<p><b>Apply the YAML File:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Use kubectl to create the Persistent Volume:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubectl apply -f data-volume-pv.yaml<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"5_Tainting_a_Node_and_Managing_Pod_Scheduling_with_Taints_and_Tolerations\"><\/span><span style=\"font-weight: 400;\">5. Tainting a Node and Managing Pod Scheduling with Taints and Tolerations<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">\u00a0Taint the worker node node02 to be Unschedulable. Once done, create a Pod named test-mysql with the image mysql:5.7 to ensure that workloads are not scheduled to this worker node. Finally, create a new Pod named prod-mysql with the image mysql:5.7 and a toleration to be scheduled on node02.<\/span><\/p>\n<h4><span style=\"font-weight: 400;\">Answer<\/span><\/h4>\n<p><b>Taint the Worker Node:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Taint the node node02 to make it unschedulable by using the following command:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubectl taint nodes node02 key=value:NoSchedule<\/span><\/p>\n<p><b>Create the Pod test-mysql:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Create a YAML file named test-mysql.yaml for the Pod:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">apiVersion: v1<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kind: Pod<\/span><\/p>\n<p><span style=\"font-weight: 400;\">metadata:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0name: test-mysql<\/span><\/p>\n<p><span style=\"font-weight: 400;\">spec:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0containers:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0&#8211; name: mysql<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0image: mysql:5.7<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Apply this YAML file using kubectl:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubectl apply -f test-mysql.yaml<\/span><\/p>\n<p><b>Create the Pod prod-mysql with Toleration:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Create a YAML file named prod-mysql.yaml for the Pod with a toleration:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">apiVersion: v1<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kind: Pod<\/span><\/p>\n<p><span style=\"font-weight: 400;\">metadata:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0name: prod-mysql<\/span><\/p>\n<p><span style=\"font-weight: 400;\">spec:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0tolerations:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0&#8211; key: &#8220;key&#8221;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0operator: &#8220;Equal&#8221;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0value: &#8220;value&#8221;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0effect: &#8220;NoSchedule&#8221;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0containers:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0&#8211; name: mysql<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0image: mysql:5.7<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Apply this YAML file using kubectl:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubectl apply -f prod-mysql.yaml<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"6_Draining_a_Node_and_Rescheduling_Pods_to_Other_Nodes\"><\/span><span style=\"font-weight: 400;\">6. Draining a Node and Rescheduling Pods to Other Nodes<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Mark the node named node03 as un-schedulable and safely evict all the pods running on it. Ensure that the pods are rescheduled on other available nodes.<\/span><\/p>\n<h4><span style=\"font-weight: 400;\">Answer<\/span><\/h4>\n<p><b>Drain the Node:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Use the kubectl drain command to mark node03 as unschedulable and evict all the pods running on it. This command will safely evict the pods and attempt to reschedule them on other available nodes:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubectl drain node03 &#8211;ignore-daemonsets &#8211;delete-local-data<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">&#8211;ignore-daemonsets: Ensures that DaemonSet-managed pods are not evicted.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">&#8211;delete-local-data: Allows the deletion of pods with local storage.<\/span><\/li>\n<\/ul>\n<p><b>Verify the Pods are Rescheduled:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Check the status of the pods to confirm they have been rescheduled:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubectl get pods &#8211;all-namespaces -o wide<\/span><\/p>\n<h4><span style=\"font-weight: 400;\">Explanation:<\/span><\/h4>\n<p><b>Draining Node (node03): <\/b><span style=\"font-weight: 400;\">This command marks the node as unschedulable and safely evicts the pods, allowing them to be rescheduled on other nodes. It helps in maintenance tasks or preparing the node for decommissioning.<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"7_Creating_a_Pod\"><\/span><span style=\"font-weight: 400;\">7. Creating a Pod\u00a0<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Create a Pod named nginx-pod with the image nginx:latest.<\/span><\/p>\n<h4><span style=\"font-weight: 400;\">Answer:<\/span><\/h4>\n<p><b>Create the Pod YAML File:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Create a YAML file named nginx-pod.yaml for the Pod:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">apiVersion: v1<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kind: Pod<\/span><\/p>\n<p><span style=\"font-weight: 400;\">metadata:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0name: nginx-pod<\/span><\/p>\n<p><span style=\"font-weight: 400;\">spec:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0containers:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0&#8211; name: nginx<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0image: nginx:latest<\/span><\/p>\n<p><b>Apply the YAML File:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Use kubectl to create the Pod:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubectl apply -f nginx-pod.yaml<\/span><\/p>\n<h4><span style=\"font-weight: 400;\">Explanation:<\/span><\/h4>\n<p><b>Pod (nginx-pod):<\/b><span style=\"font-weight: 400;\"> This Pod will run the nginx:latest image, which provides the Nginx web server.<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"8_Creating_a_NetworkPolicy_to_Deny_All_Egress_Traffic\"><\/span><span style=\"font-weight: 400;\">8. Creating a NetworkPolicy to Deny All Egress Traffic<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Create a NetworkPolicy that denies all egress traffic from a namespace.<\/span><\/p>\n<h4><span style=\"font-weight: 400;\">Answer:<\/span><\/h4>\n<p><b>Create the NetworkPolicy YAML File:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Create a YAML file named deny-all-egress.yaml for the NetworkPolicy:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">apiVersion:<\/span><a href=\"http:\/\/networking.k8s.io\/v1\" target=\"_blank\" rel=\"nofollow noopener\"> <span style=\"font-weight: 400;\">networking.k8s.io\/v1<\/span><\/a><\/p>\n<p><span style=\"font-weight: 400;\">kind: NetworkPolicy<\/span><\/p>\n<p><span style=\"font-weight: 400;\">metadata:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0name: deny-all-egress<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0namespace: default<\/span><\/p>\n<p><span style=\"font-weight: 400;\">spec:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0podSelector: {}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0policyTypes:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0&#8211; Egress<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0egress:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0&#8211; {}<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>podSelector: {} <\/b><span style=\"font-weight: 400;\">applies the policy to all Pods in the namespace.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>policyTypes: [Egress]<\/b><span style=\"font-weight: 400;\"> specifies that this policy applies to egress traffic.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>egress: [ {} ]<\/b><span style=\"font-weight: 400;\"> with an empty rule denies all outbound traffic from the Pods.<\/span><\/li>\n<\/ul>\n<p><b>Apply the YAML File:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Use kubectl to create the NetworkPolicy:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubectl apply -f deny-all-egress.yaml<\/span><\/p>\n<h4><span style=\"font-weight: 400;\">Explanation:<\/span><\/h4>\n<p><b>NetworkPolicy (deny-all-egress):<\/b><span style=\"font-weight: 400;\"> This policy denies all egress traffic from Pods in the specified namespace, preventing them from initiating any outbound connections.<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"9_ClusterRole_and_ClusterRole_Binding\"><\/span><span style=\"font-weight: 400;\">9. ClusterRole and ClusterRole Binding<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Create a new ClusterRole named view-pods-role. This ClusterRole should allow any resource associated with it to get, list, and watch Pods.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Next, create a new namespace named test-namespace. Within that namespace, create a new ServiceAccount named view-pods-sa.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Bind the view-pods-role ClusterRole to the view-pods-sa ServiceAccount, ensuring that the binding is limited to the test-namespace.<\/span><\/p>\n<h4><span style=\"font-weight: 400;\">Answer:<\/span><\/h4>\n<p><b>Create the ClusterRole:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Create a YAML file named view-pods-role.yaml for the ClusterRole:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">apiVersion:<\/span><a href=\"http:\/\/rbac.authorization.k8s.io\/v1\" target=\"_blank\" rel=\"nofollow noopener\"> <span style=\"font-weight: 400;\">rbac.authorization.k8s.io\/v1<\/span><\/a><\/p>\n<p><span style=\"font-weight: 400;\">kind: ClusterRole<\/span><\/p>\n<p><span style=\"font-weight: 400;\">metadata:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0name: view-pods-role<\/span><\/p>\n<p><span style=\"font-weight: 400;\">rules:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">&#8211; apiGroups: [&#8220;&#8221;]<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0resources: [&#8220;pods&#8221;]<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0verbs: [&#8220;get&#8221;, &#8220;list&#8221;, &#8220;watch&#8221;]<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Apply this YAML file using kubectl:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubectl apply -f view-pods-role.yaml<\/span><\/p>\n<p><b>Create the Namespace:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Create a YAML file named test-namespace.yaml for the namespace:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">apiVersion: v1<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kind: Namespace<\/span><\/p>\n<p><span style=\"font-weight: 400;\">metadata:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0name: test-namespace<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Apply this YAML file using kubectl:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubectl apply -f test-namespace.yaml<\/span><\/p>\n<p><b>Create the ServiceAccount:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Create a YAML file named view-pods-sa.yaml for the ServiceAccount:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">apiVersion: v1<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kind: ServiceAccount<\/span><\/p>\n<p><span style=\"font-weight: 400;\">metadata:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0name: view-pods-sa<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0namespace: test-namespace<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Apply this YAML file using kubectl:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubectl apply -f view-pods-sa.yaml<\/span><\/p>\n<p><b>Create the ClusterRoleBinding:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Create a YAML file named view-pods-role-binding.yaml for the ClusterRoleBinding:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">apiVersion:<\/span><a href=\"http:\/\/rbac.authorization.k8s.io\/v1\" target=\"_blank\" rel=\"nofollow noopener\"> <span style=\"font-weight: 400;\">rbac.authorization.k8s.io\/v1<\/span><\/a><\/p>\n<p><span style=\"font-weight: 400;\">kind: ClusterRoleBinding<\/span><\/p>\n<p><span style=\"font-weight: 400;\">metadata:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0name: view-pods-role-binding<\/span><\/p>\n<p><span style=\"font-weight: 400;\">subjects:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">&#8211; kind: ServiceAccount<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0name: view-pods-sa<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0namespace: test-namespace<\/span><\/p>\n<p><span style=\"font-weight: 400;\">roleRef:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0kind: ClusterRole<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0name: view-pods-role<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0apiGroup:<\/span><a href=\"http:\/\/rbac.authorization.k8s.io\" target=\"_blank\" rel=\"nofollow noopener\"> <span style=\"font-weight: 400;\">rbac.authorization.k8s.io<\/span><\/a><\/p>\n<p><span style=\"font-weight: 400;\">Apply this YAML file using kubectl:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubectl apply -f view-pods-role-binding.yaml<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"10_Node_Maintenance_and_Pod_Rescheduling\"><\/span><span style=\"font-weight: 400;\">10. Node Maintenance and Pod Rescheduling<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Before proceeding, ensure you have a Kubernetes cluster with at least two worker nodes.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Apply the following manifest file:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubectl apply -f<\/span><\/p>\n<p><a href=\"https:\/\/raw.githubusercontent.com\/zealvora\/myrepo\/master\/demo-files\/maintenance.yaml\" target=\"_blank\" rel=\"nofollow noopener\"> <span style=\"font-weight: 400;\">https:\/\/raw.githubusercontent.com\/zealvora\/myrepo\/master\/demo-files\/maintenance.yaml<\/span><\/a><\/p>\n<p><b>Requirements:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Identify the node where a pod named app-pod is currently running.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Mark that node as unschedulable and evict all the pods from it, ensuring they are rescheduled on the other available nodes.<\/span><\/p>\n<h4><span style=\"font-weight: 400;\">Answer:<\/span><\/h4>\n<p><b>Identify the Node:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">To find the node on which the app-pod is running, use the following command:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubectl get pod app-pod -o wide<\/span><\/p>\n<p><b>Drain the Node:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Suppose the node identified in the previous step is node01. To mark node01 as unschedulable and evict all pods from it, use:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubectl drain node01 &#8211;ignore-daemonsets &#8211;delete-local-data<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>&#8211;ignore-daemonsets:<\/b><span style=\"font-weight: 400;\"> Ensures DaemonSet-managed pods are not evicted.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>&#8211;delete-local-data:<\/b><span style=\"font-weight: 400;\"> Allows the deletion of pods with local storage.<\/span><\/li>\n<\/ul>\n<p><b>Verify Pod Rescheduling:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Check that the app-pod and any other evicted pods have been rescheduled on other nodes:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubectl get pods &#8211;all-namespaces -o wide<\/span><\/p>\n<h4><span style=\"font-weight: 400;\">Explanation:<\/span><\/h4>\n<p><b>Node Identification<\/b><span style=\"font-weight: 400;\">: This step determines which node is hosting the specified pod.<\/span><\/p>\n<p><b>Node Draining:<\/b><span style=\"font-weight: 400;\"> This process involves marking the node as unschedulable and evicting pods to prepare the node for maintenance or decommissioning.<\/span><\/p>\n<p><b>Pod Rescheduling:<\/b><span style=\"font-weight: 400;\"> Ensures that pods are rescheduled on other nodes to maintain application availability.<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"11_KUBEADM_Cluster_Setup\"><\/span><span style=\"font-weight: 400;\">11. KUBEADM Cluster Setup<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Set up a new Kubernetes cluster using kubeadm. The cluster should be based on Kubernetes version 1.21.0. Ensure that all components, including kubelet, kubectl, and kubeadm, are running the same version. The cluster should be configured on CentOS OS.<\/span><\/p>\n<h4><span style=\"font-weight: 400;\">Answer:<\/span><\/h4>\n<p><b>Prepare the Nodes:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Ensure that the CentOS OS is up to date and has the necessary prerequisites installed:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">sudo yum update -y<\/span><\/p>\n<p><span style=\"font-weight: 400;\">sudo yum install -y yum-utils<\/span><\/p>\n<p><span style=\"font-weight: 400;\">sudo yum install -y epel-release<\/span><\/p>\n<p><b>Install Docker:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Install Docker, which is required for Kubernetes:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">sudo yum install -y docker<\/span><\/p>\n<p><span style=\"font-weight: 400;\">sudo systemctl start docker<\/span><\/p>\n<p><span style=\"font-weight: 400;\">sudo systemctl enable docker<\/span><\/p>\n<p><b>Install Kubernetes Components:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Add the Kubernetes repository and install the required components (kubeadm, kubelet, and kubectl), ensuring they are at version 1.21.0:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">sudo tee \/etc\/yum.repos.d\/kubernetes.repo &lt;&lt;EOF<\/span><\/p>\n<p><span style=\"font-weight: 400;\">[kubernetes]<\/span><\/p>\n<p><span style=\"font-weight: 400;\">name=Kubernetes<\/span><\/p>\n<p><span style=\"font-weight: 400;\">baseurl=<\/span><a href=\"https:\/\/packages.cloud.google.com\/yum\/repos\/kubernetes-el7-x86_64\" target=\"_blank\" rel=\"nofollow noopener\"><span style=\"font-weight: 400;\">https:\/\/packages.cloud.google.com\/yum\/repos\/kubernetes-el7-x86_64<\/span><\/a><\/p>\n<p><span style=\"font-weight: 400;\">enabled=1<\/span><\/p>\n<p><span style=\"font-weight: 400;\">gpgcheck=1<\/span><\/p>\n<p><span style=\"font-weight: 400;\">gpgkey=<\/span><a href=\"https:\/\/packages.cloud.google.com\/yum\/doc\/yum-key.gpg\" target=\"_blank\" rel=\"nofollow noopener\"><span style=\"font-weight: 400;\">https:\/\/packages.cloud.google.com\/yum\/doc\/yum-key.gpg<\/span><\/a><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><a href=\"https:\/\/packages.cloud.google.com\/yum\/doc\/rpm-package-key.gpg\" target=\"_blank\" rel=\"nofollow noopener\"><span style=\"font-weight: 400;\">https:\/\/packages.cloud.google.com\/yum\/doc\/rpm-package-key.gpg<\/span><\/a><\/p>\n<p><span style=\"font-weight: 400;\">EOF<\/span><\/p>\n<p><span style=\"font-weight: 400;\">sudo yum install -y kubelet-1.21.0 kubeadm-1.21.0 kubectl-1.21.0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">sudo systemctl enable kubelet<\/span><\/p>\n<p><b>Initialize the Kubernetes Cluster:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Initialize the cluster using kubeadm:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">sudo kubeadm init &#8211;kubernetes-version=v1.21.0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">After the initialization, follow the instructions provided by kubeadm to set up the kubectl configuration for the root user:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">mkdir -p $HOME\/.kube<\/span><\/p>\n<p><span style=\"font-weight: 400;\">sudo cp -i \/etc\/kubernetes\/admin.conf $HOME\/.kube\/config<\/span><\/p>\n<p><span style=\"font-weight: 400;\">sudo chown $(id -u):$(id -g) $HOME\/.kube\/config<\/span><\/p>\n<p><b>Install a Pod Network Add-on:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Install a network add-on, such as Calico or Flannel. For example, to install Calico:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubectl apply -f<\/span><a href=\"https:\/\/docs.projectcalico.org\/manifests\/calico.yaml\" target=\"_blank\" rel=\"nofollow noopener\"> <span style=\"font-weight: 400;\">https:\/\/docs.projectcalico.org\/manifests\/calico.yaml<\/span><\/a><\/p>\n<h4><span style=\"font-weight: 400;\">Explanation:<\/span><\/h4>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>OS Preparation:<\/b><span style=\"font-weight: 400;\"> Ensures CentOS is ready for Kubernetes installation.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Docker Installation:<\/b><span style=\"font-weight: 400;\"> Installs Docker, necessary for running Kubernetes containers.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Kubernetes Components:<\/b><span style=\"font-weight: 400;\"> Installs kubeadm, kubelet, and kubectl at the specified version.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Cluster Initialization: <\/b><span style=\"font-weight: 400;\">Uses kubeadm to set up the Kubernetes cluster.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Pod Network Add-on:<\/b><span style=\"font-weight: 400;\"> Deploys a network add-on to allow communication between Pods.<\/span><\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"12_KUBEADM_Cluster_Upgrade\"><\/span><span style=\"font-weight: 400;\">12. KUBEADM Cluster Upgrade<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Upgrade the kubeadm cluster created in the previous step from version 1.20.0 to version 1.21.0. Ensure that kubelet and kubectl are also upgraded to match the new version of kubeadm. Before starting the upgrade, drain the master node and make sure to uncordon it after the upgrade. No other worker nodes should be upgraded.<\/span><\/p>\n<h4><span style=\"font-weight: 400;\">Answer:<\/span><\/h4>\n<p><b>Drain the Master Node:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Before upgrading, drain the master node to ensure that no workloads are running on it. Replace master-node with the actual name of your master node:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubectl drain master-node &#8211;ignore-daemonsets &#8211;delete-local-data<\/span><\/p>\n<p><b>Upgrade Kubernetes Components:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Update the Kubernetes components (kubeadm, kubelet, and kubectl) to version 1.21.0:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">sudo apt-get update &amp;&amp; sudo apt-get install -y apt-transport-https ca-certificates curl<\/span><\/p>\n<p><span style=\"font-weight: 400;\">curl -s<\/span><a href=\"https:\/\/packages.cloud.google.com\/apt\/doc\/apt-key.gpg\" target=\"_blank\" rel=\"nofollow noopener\"> <span style=\"font-weight: 400;\">https:\/\/packages.cloud.google.com\/apt\/doc\/apt-key.gpg<\/span><\/a><span style=\"font-weight: 400;\"> | sudo apt-key add &#8211;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">echo &#8220;deb<\/span><a href=\"https:\/\/apt.kubernetes.io\/\" target=\"_blank\" rel=\"nofollow noopener\"> <span style=\"font-weight: 400;\">https:\/\/apt.kubernetes.io\/<\/span><\/a><span style=\"font-weight: 400;\"> kubernetes-xenial main&#8221; | sudo tee \/etc\/apt\/sources.list.d\/kubernetes.list<\/span><\/p>\n<p><span style=\"font-weight: 400;\">sudo apt-get update<\/span><\/p>\n<p><span style=\"font-weight: 400;\">sudo apt-get install -y kubeadm=1.21.0-00 kubelet=1.21.0-00 kubectl=1.21.0-00<\/span><\/p>\n<p><b>Upgrade the Cluster:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Perform the upgrade of the cluster components:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">sudo kubeadm upgrade apply v1.21.0<\/span><\/p>\n<p><b>Update kubelet Configuration:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">After upgrading kubeadm, restart kubelet to apply the new version:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">sudo systemctl restart kubelet<\/span><\/p>\n<p><b>Uncordon the Master Node:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Once the upgrade is complete, uncordon the master node to allow scheduling of new pods:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubectl uncordon master-node<\/span><\/p>\n<p><b>Verify the Upgrade:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Check the versions of the cluster components to ensure the upgrade was successful:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubectl version &#8211;short<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubeadm version<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubelet &#8211;version<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"13_ETCD_Backup_Restore_with_Data_Verification\"><\/span><span style=\"font-weight: 400;\">13. ETCD Backup &amp; Restore with Data Verification<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">For this task, you should have a working ETCD cluster configured with TLS certificates. You can follow the guide below to set up an ETCD cluster:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">ETCD Cluster Setup Guide<\/span><\/p>\n<p><b>Requirements:<\/b><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Add the following data to the ETCD cluster:<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">info &#8220;This is a test&#8221;<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Take a backup of the ETCD cluster. Store the backup at \/tmp\/testbackup.db.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Add one more piece of data to the ETCD cluster:<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">info &#8220;This is an update&#8221;<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Restore the backup from \/tmp\/testbackup.db to the ETCD cluster.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Create a user named etcduser using the useradd command.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Ensure that the directory where the ETCD backup data is restored has full permissions for the etcduser.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Verify if the data &#8220;This is a test&#8221; is present in the ETCD cluster after the restoration.<\/span><\/li>\n<\/ul>\n<h4><span style=\"font-weight: 400;\">Answer:<\/span><\/h4>\n<p><b>Add Initial Data to ETCD:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Use the etcdctl command to add data to the ETCD cluster:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">etcdctl put info &#8220;This is a test&#8221;<\/span><\/p>\n<p><b>Take a Backup of the ETCD Cluster:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Use the etcdctl snapshot save command to create a backup:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">etcdctl snapshot save \/tmp\/testbackup.db &#8211;cert=\/path\/to\/etcd-cert.pem &#8211;key=\/path\/to\/etcd-key.pem &#8211;cacert=\/path\/to\/etcd-ca.pem<\/span><\/p>\n<p><b>Add More Data to ETCD:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Add the additional data to ETCD:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">etcdctl put info &#8220;This is an update&#8221;<\/span><\/p>\n<p><b>Restore the Backup:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Use the etcdctl snapshot restore command to restore the backup:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">etcdctl snapshot restore \/tmp\/testbackup.db &#8211;data-dir=\/var\/lib\/etcd &#8211;name=etcd-restore &#8211;cert=\/path\/to\/etcd-cert.pem &#8211;key=\/path\/to\/etcd-key.pem &#8211;cacert=\/path\/to\/etcd-ca.pem<\/span><\/p>\n<p><b>Create etcduser:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Create the user using:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">sudo useradd etcduser<\/span><\/p>\n<p><b>Set Directory Permissions:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Change the ownership of the directory to etcduser:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">sudo chown etcduser:etcduser \/var\/lib\/etcd<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Ensure that etcduser has full permissions:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">sudo chmod 700 \/var\/lib\/etcd<\/span><\/p>\n<p><b>Verify Data Presence:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Check if the data &#8220;This is a test&#8221; is present in the ETCD cluster:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">etcdctl get info &#8211;cert=\/path\/to\/etcd-cert.pem &#8211;key=\/path\/to\/etcd-key.pem &#8211;cacert=\/path\/to\/etcd-ca.pem<\/span><\/p>\n<h4><span style=\"font-weight: 400;\">Explanation:<\/span><\/h4>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Data Addition: <\/b><span style=\"font-weight: 400;\">Adds and updates data in ETCD to test the backup and restore process.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Backup and Restore: <\/b><span style=\"font-weight: 400;\">Demonstrates how to create and restore a backup of ETCD data.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>User Management and Permissions:<\/b><span style=\"font-weight: 400;\"> Ensures that the backup directory is accessible by the appropriate user.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Data Verification: <\/b><span style=\"font-weight: 400;\">Confirms that data has been correctly restored and is present in the ETCD cluster.<\/span><\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"14_Network_Policies\"><\/span><span style=\"font-weight: 400;\">14. Network Policies<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Create a new namespace named test-namespace.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Create a new network policy named restricted-network-policy in the test-namespace.<\/span><\/p>\n<p><b>Requirements:<\/b><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Network Policy should allow Pods within the test-namespace to connect to each other only on Port 443. No other ports should be allowed.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">No Pods from outside of the test-namespace should be able to connect to any Pods inside the test-namespace.<\/span><\/li>\n<\/ul>\n<h4><span style=\"font-weight: 400;\">Answer:<\/span><\/h4>\n<p><b>Create the Namespace:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Create a YAML file named test-namespace.yaml for the namespace:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">apiVersion: v1<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kind: Namespace<\/span><\/p>\n<p><span style=\"font-weight: 400;\">metadata:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0name: test-namespace<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Apply the YAML file:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubectl apply -f test-namespace.yaml<\/span><\/p>\n<p><b>Create the Network Policy:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Create a YAML file named restricted-network-policy.yaml for the Network Policy:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">apiVersion:<\/span><a href=\"http:\/\/networking.k8s.io\/v1\" target=\"_blank\" rel=\"nofollow noopener\"> <span style=\"font-weight: 400;\">networking.k8s.io\/v1<\/span><\/a><\/p>\n<p><span style=\"font-weight: 400;\">kind: NetworkPolicy<\/span><\/p>\n<p><span style=\"font-weight: 400;\">metadata:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0name: restricted-network-policy<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0namespace: test-namespace<\/span><\/p>\n<p><span style=\"font-weight: 400;\">spec:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0podSelector: {}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0policyTypes:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0&#8211; Ingress<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0&#8211; Egress<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0ingress:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0&#8211; from:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8211; podSelector: {}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0ports:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8211; protocol: TCP<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0port: 443<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0egress:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0&#8211; to:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8211; podSelector: {}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0ports:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8211; protocol: TCP<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0port: 443<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>podSelector: <\/b><span style=\"font-weight: 400;\">{} applies the policy to all Pods in the namespace.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>policyTypes:<\/b><span style=\"font-weight: 400;\"> [Ingress, Egress] specifies that the policy applies to both inbound and outbound traffic.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>ingress <\/b><span style=\"font-weight: 400;\">allows incoming connections only from Pods within the same namespace on Port 443.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>egress<\/b><span style=\"font-weight: 400;\"> allows outgoing connections only to Pods within the same namespace on Port 443.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Apply the YAML file:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubectl apply -f restricted-network-policy.yaml<\/span><\/p>\n<h4><span style=\"font-weight: 400;\">Explanation:<\/span><\/h4>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Namespace Creation: <\/b><span style=\"font-weight: 400;\">Creates a separate namespace test-namespace for the Network Policy.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Network Policy:<\/b><span style=\"font-weight: 400;\"> Configures the Network Policy to restrict traffic such that:<\/span><\/li>\n<\/ul>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Pods within the namespace can only communicate with each other on Port 443.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">No external Pods can communicate with Pods inside the namespace.<\/span><\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"15_Scale_Deployments\"><\/span><span style=\"font-weight: 400;\">15. Scale Deployments<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Create a new deployment named web-deployment using the nginx:latest image. The deployment should initially have 2 replicas.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Scale the deployment to 8 replicas.<\/span><\/p>\n<h4><span style=\"font-weight: 400;\">Answer:<\/span><\/h4>\n<p><b>Create the Deployment:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Create a YAML file named web-deployment.yaml for the deployment:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">apiVersion: apps\/v1<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kind: Deployment<\/span><\/p>\n<p><span style=\"font-weight: 400;\">metadata:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0name: web-deployment<\/span><\/p>\n<p><span style=\"font-weight: 400;\">spec:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0replicas: 2<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0selector:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0matchLabels:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0app: web<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0template:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0metadata:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0labels:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0app: web<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0spec:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0containers:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8211; name: nginx<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0image: nginx:latest<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0ports:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8211; containerPort: 80<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Apply the YAML file:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubectl apply -f web-deployment.yaml<\/span><\/p>\n<p><b>Scale the Deployment:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Use the kubectl scale command to change the number of replicas to 8:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubectl scale deployment web-deployment &#8211;replicas=8<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Alternatively, you can update the replica count directly in the YAML file and reapply it:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">spec:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0replicas: 8<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Reapply the updated YAML file:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubectl apply -f web-deployment.yaml<\/span><\/p>\n<p><b>Verify the Scaling:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Check the status of the deployment to ensure it has the desired number of replicas:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubectl get deployments<\/span><\/p>\n<h4><span style=\"font-weight: 400;\">Explanation:<\/span><\/h4>\n<p><b>Deployment Creation:<\/b><span style=\"font-weight: 400;\"> Initializes a deployment with the nginx:latest image and sets the initial replica count to 2.<\/span><\/p>\n<p><b>Scaling the Deployment: <\/b><span style=\"font-weight: 400;\">Adjusts the number of replicas to 8 to handle increased load or ensure high availability.<\/span><\/p>\n<p><b>Verification:<\/b><span style=\"font-weight: 400;\"> Confirms that the deployment has been scaled to the desired number of replicas<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"16_Multi-Container_Pods\"><\/span><span style=\"font-weight: 400;\">16. Multi-Container Pods<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Create a pod named multi-app-pod that contains two containers: one running the nginx:latest image and the other running the redis:alpine image.<\/span><\/p>\n<h4><span style=\"font-weight: 400;\">Answer:<\/span><\/h4>\n<p><b>Create the Pod YAML File:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Create a YAML file named multi-app-pod.yaml for the pod:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">apiVersion: v1<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kind: Pod<\/span><\/p>\n<p><span style=\"font-weight: 400;\">metadata:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0name: multi-app-pod<\/span><\/p>\n<p><span style=\"font-weight: 400;\">spec:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0containers:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0&#8211; name: nginx-container<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0image: nginx:latest<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0ports:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8211; containerPort: 80<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0&#8211; name: redis-container<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0image: redis:alpine<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0ports:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8211; containerPort: 6379<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Container 1 (nginx-container): <\/b><span style=\"font-weight: 400;\">Uses the nginx:latest image and exposes port 80.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Container 2 (redis-container): <\/b><span style=\"font-weight: 400;\">Uses the redis:alpine image and exposes port 6379.<\/span><\/li>\n<\/ul>\n<p><b>Apply the YAML File:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Use kubectl to create the pod:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubectl apply -f multi-app-pod.yaml<\/span><\/p>\n<p><b>Verify the Pod:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Check the status of the pod to ensure it is running:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubectl get pods<\/span><\/p>\n<p><b>Describe the Pod (Optional):<\/b><\/p>\n<p><span style=\"font-weight: 400;\">To get detailed information about the pod and its containers:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubectl describe pod multi-app-pod<\/span><\/p>\n<h4><span style=\"font-weight: 400;\">Explanation:<\/span><\/h4>\n<p><b>Pod Creation:<\/b><span style=\"font-weight: 400;\"> Defines a pod with two containers, each running a different image (nginx and redis).<\/span><\/p>\n<p><b>Verification:<\/b><span style=\"font-weight: 400;\"> Ensures the pod is running as expected and both containers are operational.<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"17_Ingress_Resource\"><\/span><span style=\"font-weight: 400;\">17. Ingress Resource<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Create a new ingress resource based on the following specifications:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Name: app-ingress<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Namespace: app-namespace<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Expose service frontend on the path of \/frontend using the service port of 3000.<\/span><\/p>\n<h4><span style=\"font-weight: 400;\">Answer:<\/span><\/h4>\n<p><b>Create the Namespace:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">If the namespace app-namespace does not already exist, create it with the following YAML file:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">apiVersion: v1<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kind: Namespace<\/span><\/p>\n<p><span style=\"font-weight: 400;\">metadata:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0name: app-namespace<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Apply the YAML file:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubectl apply -f app-namespace.yaml<\/span><\/p>\n<p><b>Create the Ingress Resource:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Create a YAML file named app-ingress.yaml for the ingress resource:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">apiVersion:<\/span><a href=\"http:\/\/networking.k8s.io\/v1\" target=\"_blank\" rel=\"nofollow noopener\"> <span style=\"font-weight: 400;\">networking.k8s.io\/v1<\/span><\/a><\/p>\n<p><span style=\"font-weight: 400;\">kind: Ingress<\/span><\/p>\n<p><span style=\"font-weight: 400;\">metadata:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0name: app-ingress<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0namespace: app-namespace<\/span><\/p>\n<p><span style=\"font-weight: 400;\">spec:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0rules:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0&#8211; host:<\/span><a href=\"http:\/\/example.com\" target=\"_blank\" rel=\"nofollow noopener\"> <span style=\"font-weight: 400;\">example.com<\/span><\/a><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0http:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0paths:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8211; path: \/frontend<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0pathType: Prefix<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0backend:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0service:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0name: frontend<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0port:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0number: 3000<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Name<\/b><span style=\"font-weight: 400;\">: app-ingress<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Namespace<\/b><span style=\"font-weight: 400;\">: app-namespace<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Service<\/b><span style=\"font-weight: 400;\">: frontend<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Path<\/b><span style=\"font-weight: 400;\">: \/frontend<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Service Port<\/b><span style=\"font-weight: 400;\">: 3000<\/span><\/li>\n<\/ul>\n<p><b>Apply the YAML File:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Use kubectl to create the ingress resource:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubectl apply -f app-ingress.yaml<\/span><\/p>\n<p><b>Verify the Ingress Resource:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Check the status of the ingress to ensure it was created successfully:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubectl get ingress -n app-namespace<\/span><\/p>\n<h4><span style=\"font-weight: 400;\">Explanation:<\/span><\/h4>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Namespace Creation:<\/b><span style=\"font-weight: 400;\"> Ensures the namespace app-namespace exists for the ingress resource.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Ingress Resource:<\/b><span style=\"font-weight: 400;\"> Configures the ingress to route traffic from \/frontend to the frontend service on port 3000.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Verification<\/b><span style=\"font-weight: 400;\">: Ensures that the ingress resource has been created and is correctly configured.<\/span><\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"18_POD_and_Logging\"><\/span><span style=\"font-weight: 400;\">18. POD and Logging<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Apply the following manifest to your Kubernetes cluster:<\/span><\/p>\n<p><a href=\"https:\/\/raw.githubusercontent.com\/zealvora\/myrepo\/master\/demo-files\/sample_pod.yaml\" target=\"_blank\" rel=\"nofollow noopener\"><span style=\"font-weight: 400;\">https:\/\/raw.githubusercontent.com\/zealvora\/myrepo\/master\/demo-files\/sample_pod.yaml<\/span><\/a><\/p>\n<p><span style=\"font-weight: 400;\">Monitor the logs for all containers that are part of the test-pod pod. Extract log lines that contain the string ERROR and write them to \/var\/logs\/error_logs.txt.<\/span><\/p>\n<h4><span style=\"font-weight: 400;\">Answer:<\/span><\/h4>\n<p><b>Apply the Manifest:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">First, apply the manifest to create the pod:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubectl apply -f<\/span><a href=\"https:\/\/raw.githubusercontent.com\/zealvora\/myrepo\/master\/demo-files\/sample_pod.yaml\" target=\"_blank\" rel=\"nofollow noopener\"> <span style=\"font-weight: 400;\">https:\/\/raw.githubusercontent.com\/zealvora\/myrepo\/master\/demo-files\/sample_pod.yaml<\/span><\/a><\/p>\n<p><b>Verify the Pod:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Ensure the pod test-pod is running:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubectl get pods<\/span><\/p>\n<p><b>Monitor and Extract Logs:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">To monitor logs for all containers in the test-pod pod, use the following command. This will stream the logs for all containers in the specified pod:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubectl logs -f test-pod &#8211;all-containers=true<\/span><\/p>\n<p><span style=\"font-weight: 400;\">To extract log lines containing the string ERROR and save them to \/var\/logs\/error_logs.txt, use the following commands.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">First, check logs for a specific container in the pod:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubectl logs test-pod -c &lt;container-name&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Replace &lt;container-name&gt; with the actual container name.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Then, extract lines containing ERROR and save to the file:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubectl logs test-pod &#8211;all-containers=true | grep &#8220;ERROR&#8221; &gt; \/var\/logs\/error_logs.txt<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Ensure the directory \/var\/logs exists or create it if needed:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">sudo mkdir -p \/var\/logs<\/span><\/p>\n<p><b>Verify the Log File:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Check the contents of the file to ensure the logs were written correctly:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">cat \/var\/logs\/error_logs.txt<\/span><\/p>\n<h4><span style=\"font-weight: 400;\">Explanation:<\/span><\/h4>\n<p><b>Manifest Application:<\/b><span style=\"font-weight: 400;\"> Applies the provided manifest to create the pod.<\/span><\/p>\n<p><b>Log Monitoring and Extraction: <\/b><span style=\"font-weight: 400;\">Monitors logs for all containers in the pod and extracts lines containing ERROR.<\/span><\/p>\n<p><b>Log File Management:<\/b><span style=\"font-weight: 400;\"> Ensures the log file directory exists and verifies the contents.<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"19_NodeSelector\"><\/span><span style=\"font-weight: 400;\">19. NodeSelector<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Create a pod named database-pod using the mysql:5.7 image. The pod should only run on nodes that have a label storage=high-performance.<\/span><\/p>\n<h4><span style=\"font-weight: 400;\">Answer:<\/span><\/h4>\n<p><b>Label a Node:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">First, ensure you have a node with the label storage=high-performance. Label a node using the following command:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubectl label nodes &lt;node-name&gt; storage=high-performance<\/span><\/p>\n<p><b>Create the Pod YAML File:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Create a YAML file named database-pod.yaml for the pod:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">apiVersion: v1<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kind: Pod<\/span><\/p>\n<p><span style=\"font-weight: 400;\">metadata:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0name: database-pod<\/span><\/p>\n<p><span style=\"font-weight: 400;\">spec:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0containers:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0&#8211; name: mysql-container<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0image: mysql:5.7<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0env:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8211; name: MYSQL_ROOT_PASSWORD<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0value: rootpassword<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0nodeSelector:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0storage: high-performance<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Pod Name:<\/b><span style=\"font-weight: 400;\"> database-pod<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Image<\/b><span style=\"font-weight: 400;\">: mysql:5.7<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Node Selector:<\/b><span style=\"font-weight: 400;\"> Ensures the pod runs on nodes with the label storage=high-performance.<\/span><\/li>\n<\/ul>\n<p><b>Apply the YAML File:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Use kubectl to create the pod:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubectl apply -f database-pod.yaml<\/span><\/p>\n<p><b>Verify the Pod:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Check the status of the pod to ensure it is running on the correct node:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubectl get pods -o wide<\/span><\/p>\n<h4><span style=\"font-weight: 400;\">Explanation:<\/span><\/h4>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Node Labeling<\/b><span style=\"font-weight: 400;\">: Ensures that the node has the required label for the pod to be scheduled.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Pod Creation:<\/b><span style=\"font-weight: 400;\"> Defines a pod with a node selector to ensure it runs on the correct node.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Verification<\/b><span style=\"font-weight: 400;\">: Checks that the pod is correctly scheduled based on the node selector.<\/span><\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"20_Resource_Requests_and_Limits\"><\/span><span style=\"font-weight: 400;\">20. Resource Requests and Limits<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Create a new deployment named resource-deployment using the busybox image. The deployment should initially have 2 replicas.<\/span><\/p>\n<p><b>Set resource requests and limits for the containers in the deployment:<\/b><\/p>\n<p><b>Requests:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">CPU: 100m<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Memory: 128Mi<\/span><\/p>\n<p><b>Limits:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">CPU: 500m<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Memory: 256Mi<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Scale the deployment to 4 replicas.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Verify that the resource requests and limits are correctly applied to the containers.<\/span><\/p>\n<h4><span style=\"font-weight: 400;\">Answer:<\/span><\/h4>\n<p><b>Create the Deployment YAML File:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Create a YAML file named resource-deployment.yaml for the deployment:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">apiVersion: apps\/v1<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kind: Deployment<\/span><\/p>\n<p><span style=\"font-weight: 400;\">metadata:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0name: resource-deployment<\/span><\/p>\n<p><span style=\"font-weight: 400;\">spec:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0replicas: 2<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0selector:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0matchLabels:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0app: busybox<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0template:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0metadata:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0labels:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0app: busybox<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0spec:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0containers:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8211; name: busybox-container<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0image: busybox<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0command: [&#8220;sh&#8221;, &#8220;-c&#8221;, &#8220;sleep 3600&#8221;]<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0resources:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0requests:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0cpu: &#8220;100m&#8221;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0memory: &#8220;128Mi&#8221;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0limits:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0cpu: &#8220;500m&#8221;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0memory: &#8220;256Mi&#8221;<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Name<\/b><span style=\"font-weight: 400;\">: resource-deployment<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Image<\/b><span style=\"font-weight: 400;\">: busybox<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Requests<\/b><span style=\"font-weight: 400;\">: CPU 100m, Memory 128Mi<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Limits<\/b><span style=\"font-weight: 400;\">: CPU 500m, Memory 256Mi<\/span><\/li>\n<\/ul>\n<p><b>Apply the YAML File:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Use kubectl to create the deployment:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubectl apply -f resource-deployment.yaml<\/span><\/p>\n<p><b>Scale the Deployment:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Use the kubectl scale command to change the number of replicas to 4:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubectl scale deployment resource-deployment &#8211;replicas=4<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Alternatively, update the replica count in the YAML file and reapply:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">spec:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0replicas: 4<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Reapply the updated YAML file:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubectl apply -f resource-deployment.yaml<\/span><\/p>\n<p><b>Verify Resource Requests and Limits:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Check the deployment to ensure the resource requests and limits are applied correctly:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubectl describe deployment resource-deployment<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Look for the Resources section under the container specifications to verify the requests and limits.<\/span><\/p>\n<p><b>Verify Pods and Replica Count:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Check that the deployment has the desired number of replicas:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubectl get deployments<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Check the status of the pods to confirm they are running:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">kubectl get pods<\/span><\/p>\n<h4><span style=\"font-weight: 400;\">Explanation:<\/span><\/h4>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Deployment Creation:<\/b><span style=\"font-weight: 400;\"> Defines a deployment with specified resource requests and limits for the containers.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Scaling<\/b><span style=\"font-weight: 400;\">: Adjusts the number of replicas to manage load and availability.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Verification<\/b><span style=\"font-weight: 400;\">: Ensures that the resource requests and limits are correctly applied and that the deployment is running the desired number of replicas.<\/span><\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"Kubernetes_Exam_Preparation_Tips\"><\/span><span style=\"font-weight: 400;\">Kubernetes Exam Preparation Tips<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Worry no more if these questions make you doubt your prep strategy or make you nervous.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Here are a few Kubernetes preparation tips to keep up your sleeves:\u00a0<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Get acquainted with the Kubernetes setup for the exam\u00a0<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">When practicing for the CKA practical questions, use the same operating system and tools used in the exam. You can save time by reading a lengthy manual and learning how to use a command-line tool when solving questions.\u00a0<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Go through the Kubernetes documentation.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">The CKA exam covers numerous concepts for setting up K8s Kubernetes clusters, stateless PHP examples, how to use Kubernetes API and more. The best way to dive deep into these topics is to review the<\/span><a href=\"https:\/\/kubernetes.io\/docs\/home\/\" target=\"_blank\" rel=\"nofollow noopener\"> <span style=\"font-weight: 400;\">Kubernetes documentation<\/span><\/a><span style=\"font-weight: 400;\"> carefully.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Learn Kubectl commands<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Kubectl is the most critical Kubernetes tool for interacting with Kubernetes setup and clusters. Ensure you are well-versed in Kubectl commands to create, update, and handle Kubernetes resources. Such commands are also critical to ensure Kubernetes security. Watch our <\/span><a href=\"https:\/\/www.whizlabs.com\/certified-kubernetes-administrator\/#_=_\" target=\"_blank\" rel=\"nofollow noopener\"><span style=\"font-weight: 400;\">curated video lectures<\/span><\/a><span style=\"font-weight: 400;\"> by Kubernetes experts to learn these commands interactively.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Get hands-on experience with Kubernetes hands-on labs<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Learn how to create Kubernetes clusters using Minikube, Kind, or K3s and how you can implement Kubernetes best practices. One of the best ways to do this is to use hands-on labs. Whizlabs offers<\/span><a href=\"https:\/\/www.whizlabs.com\/hands-on-learning-kubernetes-fundamentals\/\" target=\"_blank\" rel=\"noopener\"> <span style=\"font-weight: 400;\">20+ Practice Kubernetes Labs<\/span><\/a><span style=\"font-weight: 400;\"> to enhance your skills and provide practical experience guided by experts. It includes:\u00a0<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Kubernetes storage<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Monitoring and logging\u00a0<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Kubernetes networking<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Cluster configuration<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Kubernetes clusters<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Practice with sample papers<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">The critical part of the CKA exam is finishing all questions quickly. If you are tight on time, solving practical problems while navigating a terminal window could be difficult. To improve your time management, solve as many practice papers as possible.\u00a0<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span><span style=\"font-weight: 400;\">Conclusion<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Hope this blog helps you understand the CKA exam pattern with the top 20 CKA certification questions in great detail and also what Kubernetes exam preparation tips to consider for beginning your Kubernetes journey. While a robust strategy is needed to prepare for the exam, it\u2019s equally important to access only upgraded and authentic training materials that will help you pass this dynamic course seamlessly. Check out our <\/span><a href=\"https:\/\/www.whizlabs.com\/labs\/library\/\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">hands-on labs<\/span><\/a><span style=\"font-weight: 400;\"> and video lectures designed to satisfy all Kubernetes exam needs and pass the exam with flying colors.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Want to learn more about the <\/span><a href=\"https:\/\/www.whizlabs.com\/blog\/kubernetes-certifications-list\/\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">CKA Certification<\/span><\/a><span style=\"font-weight: 400;\">? Talk to our experts today!\u00a0<\/span><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Certified Kubernetes Administrator (CKA) certification is an essential credential for those aiming to excel in working with containers and managing cloud-native applications on Kubernetes. In this blog, we\u2019ll walk you through the top 20 CKA certification questions to give you a solid understanding of what the exam covers. The Certified Kubernetes Administrator Exam: Things To Remember\u00a0 The Certified Kubernetes Administrator Exam teaches how to create, deploy, and manage Kubernetes best practices and clusters. Here are a few things you need to remember about the Certified Kubernetes Administrator Exam:\u00a0 The exam will cost $395 and includes one retake free of [&hellip;]<\/p>\n","protected":false},"author":13,"featured_media":97159,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"default","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[10,1862],"tags":[4952,5214],"class_list":["post-97142","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cloud-computing-certifications","category-devops","tag-cka-exam","tag-cka-exam-questions"],"uagb_featured_image_src":{"full":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/08\/CKA-scaled.webp",2560,1280,false],"thumbnail":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/08\/CKA-150x150.webp",150,150,true],"medium":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/08\/CKA-300x150.webp",300,150,true],"medium_large":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/08\/CKA-768x384.webp",768,384,true],"large":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/08\/CKA-1024x512.webp",1024,512,true],"1536x1536":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/08\/CKA-1536x768.webp",1536,768,true],"2048x2048":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/08\/CKA-2048x1024.webp",2048,1024,true],"profile_24":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/08\/CKA-scaled.webp",24,12,false],"profile_48":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/08\/CKA-scaled.webp",48,24,false],"profile_96":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/08\/CKA-scaled.webp",96,48,false],"profile_150":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/08\/CKA-scaled.webp",150,75,false],"profile_300":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/08\/CKA-scaled.webp",300,150,false],"tptn_thumbnail":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/08\/CKA-250x250.webp",250,250,true],"web-stories-poster-portrait":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/08\/CKA-640x853.webp",640,853,true],"web-stories-publisher-logo":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/08\/CKA-96x96.webp",96,96,true],"web-stories-thumbnail":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/08\/CKA-150x75.webp",150,75,true]},"uagb_author_info":{"display_name":"Pavan Gumaste","author_link":"https:\/\/www.whizlabs.com\/blog\/author\/pavan\/"},"uagb_comment_info":23,"uagb_excerpt":"The Certified Kubernetes Administrator (CKA) certification is an essential credential for those aiming to excel in working with containers and managing cloud-native applications on Kubernetes. In this blog, we\u2019ll walk you through the top 20 CKA certification questions to give you a solid understanding of what the exam covers. The Certified Kubernetes Administrator Exam: Things&hellip;","_links":{"self":[{"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/posts\/97142","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/comments?post=97142"}],"version-history":[{"count":13,"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/posts\/97142\/revisions"}],"predecessor-version":[{"id":97170,"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/posts\/97142\/revisions\/97170"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/media\/97159"}],"wp:attachment":[{"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/media?parent=97142"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/categories?post=97142"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/tags?post=97142"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}