Kubernetes Assignment– 1
Kubenetes Core Concepts
Basic Questions
- Install Minikube on your system and verify the installation using minikube version.
- Start a Minikube cluster and check its status.
- Deploy your first Pod using the kubectl run hello-pod –image=nginx.
- View all running Pods in the default namespace.
- Inspect Pod details using kubectl describe pod <pod-name>.
- Delete a Pod and verify it is removed from the cluster.
- Create a ReplicaSet with 2 replicas of an nginx Pod.
- Scale the ReplicaSet to 4 replicas.
- View all ReplicaSets running in the cluster.
- Delete the ReplicaSet and confirm all Pods are terminated.
- Create a Deployment with 3 replicas of a simple httpd Pod.
- Check Deployment details using kubectl get deployments.
- Perform a rolling update on the Deployment by changing the image version.
- Roll back the Deployment to its previous version.
- Create a new namespace called dev.
- Deploy a Pod inside the dev namespace.
- List all Pods running in all namespaces.
- Create a Service of type ClusterIP to expose a Deployment internally.
- Create a Service of type NodePort to expose a Deployment externally.
- Verify Pod-to-Service communication using kubectl exec with curl.
Intermediate Questions
- Deploy a Deployment with 2 replicas of nginx and expose it as a Service.
- Scale the Deployment to 5 replicas and verify changes.
- Perform a rolling update by upgrading the nginx image from 1.19 to 1.21.
- Perform a rollback of the Deployment to the earlier version.
- Create a namespace test and deploy a Deployment inside it.
- Restrict a Deployment to the test namespace only.
- Deploy a ReplicaSet with labels (app=web, tier=frontend) and check Pod selection.
- Delete a Pod managed by a ReplicaSet and verify it is recreated automatically.
- Deploy two different Deployments in different namespaces and verify isolation.
- Create a Service in one namespace and confirm it cannot be accessed directly from another namespace.
- Add resource requests (CPU/Memory) to a Deployment and check Pod allocation.
- Add resource limits (CPU/Memory) to the same Deployment and verify enforcement.
- Run kubectl rollout history on a Deployment and view revision history.
- Pause a Deployment rollout, make changes, and then resume it.
- Expose a Deployment as a NodePort Service and test it via Minikube’s IP.
- Use kubectl port-forward to access a Pod locally.
- Label a namespace and view it using kubectl get ns –show-labels.
- Annotate a Deployment with metadata and inspect it.
- Deploy a ReplicaSet that runs 3 Pods of busybox to run infinite sleep.
- Verify inter-Pod communication using kubectl exec to ping another Pod.
Advanced Questions
- Write a Deployment YAML file for an nginx web app with 3 replicas and apply it.
- Modify the Deployment YAML to include rolling update strategy (maxSurge=1, maxUnavailable=1).
- Trigger a rolling update by changing the container image in the YAML and reapply it.
- Roll back the Deployment to a specific revision using kubectl rollout undo.
- Create two namespaces (frontend and backend) and deploy apps in each.
- Verify namespace isolation by testing connectivity between Pods in different namespaces.
- Create a ReplicaSet YAML file for an nginx app with labels and selectors.
- Delete one Pod manually and observe how ReplicaSet recreates it.
- Deploy a full-stack app: frontend (nginx), backend (httpd), both managed by Deployments, exposed via NodePort Services.
- Deliver a final hands-on project:
- Start Minikube → Create namespace project → Deploy web app via Deployment (3 replicas) → Expose with NodePort Service → Perform rolling update → Rollback → Verify scaling.