Lab 01 — Build Your First Kubernetes Cluster
Mission Information
Section titled “Mission Information”| Item | Details |
|---|---|
| Lab ID | K8S-FND-LAB-01 |
| Difficulty | Beginner |
| Estimated Time | 60–90 minutes |
| Environment | Local workstation |
| Platform | Docker Desktop and kind |
| Cost | Free |
| Primary Role | Kubernetes Security Engineer |
| Module | Module 01 — Kubernetes Fundamentals for Security Engineers |
Mission Scenario
Section titled “Mission Scenario”CloudNova Technologies is preparing to adopt Kubernetes for its internal development and security testing environments.
Before the platform team begins deploying enterprise applications, the Cloud Security team must build a small Kubernetes cluster and verify that its core components are operating correctly.
You have joined the CloudNova Technologies security engineering team as a Junior Kubernetes Security Engineer.
Your mission is to:
- Install the required Kubernetes tools
- Create a local Kubernetes cluster
- Inspect the Control Plane and Worker Node
- Review system workloads
- Deploy a test application
- Expose the application securely for local testing
- Perform an initial cluster security review
- Collect evidence of successful implementation
- Remove the lab resources after completion
This lab establishes the technical foundation for the remaining Kubernetes Security modules.
Learning Objectives
Section titled “Learning Objectives”By completing this lab, you will be able to:
- Create a local Kubernetes cluster using kind
- Connect to the cluster using
kubectl - Inspect Kubernetes nodes and system components
- Identify the Control Plane and Worker Node
- Create and inspect a Namespace
- Deploy a containerised application
- Create a Kubernetes Service
- Review Kubernetes workload configuration
- Perform basic cluster security validation
- Troubleshoot common cluster deployment issues
Architecture
Section titled “Architecture”You will build the following environment:
Windows Workstation │ ▼Docker Desktop │ ▼kind Kubernetes Cluster │ ├── Control Plane Node │ └── Worker Node │ ▼ cloudnova-lab Namespace │ ▼ NGINX Test Deployment │ ▼ ClusterIP ServiceLab Outcomes
Section titled “Lab Outcomes”At the end of this lab, you should have:
- One running Kubernetes cluster
- One Control Plane node
- One Worker Node
- One dedicated Namespace
- One test Deployment
- Two running application Pods
- One internal ClusterIP Service
- Evidence showing the cluster is operational
- A short initial security assessment
Prerequisites
Section titled “Prerequisites”Before starting, ensure that you have:
- A Windows 10 or Windows 11 computer
- Administrative access to the workstation
- At least 8 GB of RAM
- Virtualisation enabled
- Internet access
- Docker Desktop installed
- Visual Studio Code installed
- PowerShell or Git Bash available
Recommended free disk space:
10 GB or moreTools Used
Section titled “Tools Used”| Tool | Purpose |
|---|---|
| Docker Desktop | Runs containers used as Kubernetes nodes |
| kind | Creates Kubernetes clusters using Docker containers |
| kubectl | Communicates with the Kubernetes API Server |
| PowerShell | Executes Windows commands |
| Git Bash | Optional alternative terminal |
| Visual Studio Code | Creates and edits Kubernetes manifest files |
Lab Safety
Section titled “Lab Safety”This lab runs locally on your workstation.
It does not require:
- An AWS account
- An Azure account
- A Google Cloud account
- Paid Kubernetes infrastructure
- Public internet exposure of the application
Do not use production credentials or sensitive information in this environment.
Task 01 — Verify Hardware Virtualisation
Section titled “Task 01 — Verify Hardware Virtualisation”Docker Desktop requires hardware virtualisation.
Step 1 — Open Task Manager
Section titled “Step 1 — Open Task Manager”Press:
Ctrl + Shift + EscSelect:
Performance → CPUConfirm that the following shows:
Virtualisation: EnabledIf virtualisation is disabled, enable Intel VT-x or AMD-V in the system BIOS or UEFI settings before continuing.
Task 02 — Install and Verify Docker Desktop
Section titled “Task 02 — Install and Verify Docker Desktop”Step 1 — Start Docker Desktop
Section titled “Step 1 — Start Docker Desktop”Open Docker Desktop from the Windows Start menu.
Wait until Docker Desktop reports that the Docker engine is running.
Step 2 — Verify Docker
Section titled “Step 2 — Verify Docker”PowerShell
Section titled “PowerShell”docker versionGit Bash
Section titled “Git Bash”docker versionExpected result:
Client: Version: ...
Server: Engine: Version: ...Both the Docker client and server must be available.
Step 3 — Run a Test Container
Section titled “Step 3 — Run a Test Container”PowerShell
Section titled “PowerShell”docker run --rm hello-worldGit Bash
Section titled “Git Bash”docker run --rm hello-worldExpected result:
Hello from Docker!This confirms that Docker can download and execute containers.
Task 03 — Install kubectl
Section titled “Task 03 — Install kubectl”kubectl is the command-line tool used to communicate with Kubernetes.
Option A — Install with Windows Package Manager
Section titled “Option A — Install with Windows Package Manager”Open PowerShell as Administrator.
winget install Kubernetes.kubectlClose and reopen the terminal after installation.
Option B — Use the kubectl Included with Docker Desktop
Section titled “Option B — Use the kubectl Included with Docker Desktop”Docker Desktop may already provide kubectl.
Verify it before installing another copy.
Step 1 — Verify kubectl
Section titled “Step 1 — Verify kubectl”PowerShell
Section titled “PowerShell”kubectl version --clientGit Bash
Section titled “Git Bash”kubectl version --clientExpected result:
Client Version: ...Step 2 — Locate kubectl
Section titled “Step 2 — Locate kubectl”PowerShell
Section titled “PowerShell”Get-Command kubectlGit Bash
Section titled “Git Bash”which kubectlRecord the installed location as evidence.
Task 04 — Install kind
Section titled “Task 04 — Install kind”kind stands for Kubernetes IN Docker.
It creates Kubernetes nodes as Docker containers and is suitable for:
- Local laboratories
- Development environments
- CI/CD testing
- Kubernetes security exercises
Option A — Install Using winget
Section titled “Option A — Install Using winget”PowerShell as Administrator
Section titled “PowerShell as Administrator”winget install Kubernetes.kindOption B — Install Using Chocolatey
Section titled “Option B — Install Using Chocolatey”Use this only when Chocolatey is already installed.
choco install kindStep 1 — Verify kind
Section titled “Step 1 — Verify kind”PowerShell
Section titled “PowerShell”kind versionGit Bash
Section titled “Git Bash”kind versionExpected result:
kind v...Task 05 — Create the Lab Workspace
Section titled “Task 05 — Create the Lab Workspace”Create a dedicated folder for the lab files.
PowerShell
Section titled “PowerShell”New-Item -ItemType Directory -Path C:\GoHackersCloud-Labs\kubernetes\lab-01 -ForceSet-Location C:\GoHackersCloud-Labs\kubernetes\lab-01Git Bash
Section titled “Git Bash”mkdir -p /c/GoHackersCloud-Labs/kubernetes/lab-01cd /c/GoHackersCloud-Labs/kubernetes/lab-01Verify the current directory.
PowerShell
Section titled “PowerShell”Get-LocationGit Bash
Section titled “Git Bash”pwdTask 06 — Create the Kubernetes Cluster Configuration
Section titled “Task 06 — Create the Kubernetes Cluster Configuration”You will create a two-node Kubernetes cluster containing:
- One Control Plane node
- One Worker Node
Create a file named:
kind-cluster.yamlAdd the following content:
kind: ClusterapiVersion: kind.x-k8s.io/v1alpha4
name: cloudnova-security-lab
nodes: - role: control-plane
- role: workerSave the file inside:
C:\GoHackersCloud-Labs\kubernetes\lab-01Validate the File
Section titled “Validate the File”PowerShell
Section titled “PowerShell”Get-Content .\kind-cluster.yamlGit Bash
Section titled “Git Bash”cat kind-cluster.yamlExpected content:
kind: ClusterapiVersion: kind.x-k8s.io/v1alpha4
name: cloudnova-security-lab
nodes: - role: control-plane
- role: workerTask 07 — Build the Kubernetes Cluster
Section titled “Task 07 — Build the Kubernetes Cluster”Step 1 — Create the Cluster
Section titled “Step 1 — Create the Cluster”PowerShell
Section titled “PowerShell”kind create cluster --config .\kind-cluster.yamlGit Bash
Section titled “Git Bash”kind create cluster --config kind-cluster.yamlThe process may take several minutes.
Expected output should show stages similar to:
Creating cluster "cloudnova-security-lab"Ensuring node imagePreparing nodesWriting configurationStarting control-planeInstalling CNIInstalling StorageClassJoining worker nodesSet kubectl contextStep 2 — Confirm the Cluster Exists
Section titled “Step 2 — Confirm the Cluster Exists”PowerShell
Section titled “PowerShell”kind get clustersGit Bash
Section titled “Git Bash”kind get clustersExpected result:
cloudnova-security-labStep 3 — Verify the kubectl Context
Section titled “Step 3 — Verify the kubectl Context”kubectl config current-contextExpected result:
kind-cloudnova-security-labThe context tells kubectl which Kubernetes cluster it should manage.
Task 08 — Inspect the Kubernetes Nodes
Section titled “Task 08 — Inspect the Kubernetes Nodes”Step 1 — List Nodes
Section titled “Step 1 — List Nodes”kubectl get nodesExpected result:
NAME STATUS ROLES AGE VERSIONcloudnova-security-lab-control-plane Ready control-plane ... ...cloudnova-security-lab-worker Ready <none> ... ...Both nodes should show:
STATUS: ReadyStep 2 — Display Additional Node Information
Section titled “Step 2 — Display Additional Node Information”kubectl get nodes -o wideReview:
- Node name
- Node role
- Internal IP address
- Kubernetes version
- Operating system
- Container runtime
Step 3 — Inspect the Control Plane Node
Section titled “Step 3 — Inspect the Control Plane Node”kubectl describe node cloudnova-security-lab-control-planeLocate and review:
- Roles
- Labels
- Taints
- Capacity
- Allocatable resources
- System information
- Running Pods
- Node conditions
Step 4 — Inspect the Worker Node
Section titled “Step 4 — Inspect the Worker Node”kubectl describe node cloudnova-security-lab-workerCompare the Worker Node with the Control Plane node.
Security Observation
Section titled “Security Observation”The Control Plane node normally includes a taint that discourages ordinary workloads from being scheduled on it.
Locate a value similar to:
node-role.kubernetes.io/control-plane:NoScheduleThis helps separate cluster management components from application workloads.
Task 09 — Inspect the Control Plane Containers
Section titled “Task 09 — Inspect the Control Plane Containers”Because kind runs Kubernetes nodes as Docker containers, you can inspect them directly.
Step 1 — List Docker Containers
Section titled “Step 1 — List Docker Containers”docker psExpected containers:
cloudnova-security-lab-control-planecloudnova-security-lab-workerStep 2 — Inspect the Control Plane Container
Section titled “Step 2 — Inspect the Control Plane Container”PowerShell
Section titled “PowerShell”docker inspect cloudnova-security-lab-control-planeGit Bash
Section titled “Git Bash”docker inspect cloudnova-security-lab-control-planeReview:
- Container name
- Network configuration
- Mounted volumes
- Runtime settings
- Container state
Do not modify the control-plane container manually.
Task 10 — Inspect Kubernetes System Components
Section titled “Task 10 — Inspect Kubernetes System Components”Kubernetes system components run inside the kube-system Namespace.
Step 1 — List All Namespaces
Section titled “Step 1 — List All Namespaces”kubectl get namespacesExpected Namespaces include:
defaultkube-node-leasekube-publickube-systemlocal-path-storageStep 2 — List System Pods
Section titled “Step 2 — List System Pods”kubectl get pods -n kube-systemYou should see components such as:
- CoreDNS
- etcd
- kube-apiserver
- kube-controller-manager
- kube-proxy
- kube-scheduler
Step 3 — Display Detailed System Information
Section titled “Step 3 — Display Detailed System Information”kubectl get pods -n kube-system -o wideIdentify:
- Which Pods run on the Control Plane
- Which components run on each node
- The IP address assigned to each Pod
Step 4 — Locate the API Server
Section titled “Step 4 — Locate the API Server”kubectl get pods -n kube-system | findstr kube-apiserverGit Bash alternative:
kubectl get pods -n kube-system | grep kube-apiserverStep 5 — Locate etcd
Section titled “Step 5 — Locate etcd”PowerShell
Section titled “PowerShell”kubectl get pods -n kube-system | findstr etcdGit Bash
Section titled “Git Bash”kubectl get pods -n kube-system | grep etcdStep 6 — Locate the Scheduler
Section titled “Step 6 — Locate the Scheduler”PowerShell
Section titled “PowerShell”kubectl get pods -n kube-system | findstr schedulerGit Bash
Section titled “Git Bash”kubectl get pods -n kube-system | grep schedulerSecurity Observation
Section titled “Security Observation”The following components are critical security assets:
kube-apiserveretcdkube-controller-managerkube-schedulerCompromise of these components can lead to complete cluster compromise.
Task 11 — Review Cluster Information
Section titled “Task 11 — Review Cluster Information”Run:
kubectl cluster-infoExpected output includes:
Kubernetes control plane is running at ...CoreDNS is running at ...Run:
kubectl cluster-info dumpThis command produces extensive cluster information.
For this lab, you do not need to analyse the complete output. Confirm that cluster information can be retrieved successfully.
Task 12 — Create a Dedicated Namespace
Section titled “Task 12 — Create a Dedicated Namespace”Do not deploy the application into the default Namespace.
Create a dedicated Namespace named:
cloudnova-labStep 1 — Create the Namespace
Section titled “Step 1 — Create the Namespace”kubectl create namespace cloudnova-labExpected result:
namespace/cloudnova-lab createdStep 2 — Verify the Namespace
Section titled “Step 2 — Verify the Namespace”kubectl get namespace cloudnova-labStep 3 — Inspect the Namespace
Section titled “Step 3 — Inspect the Namespace”kubectl describe namespace cloudnova-labStep 4 — Add Enterprise Labels
Section titled “Step 4 — Add Enterprise Labels”kubectl label namespace cloudnova-lab environment=developmentkubectl label namespace cloudnova-lab owner=cloud-security-teamkubectl label namespace cloudnova-lab business-unit=cloudnova-technologiesStep 5 — Review Namespace Labels
Section titled “Step 5 — Review Namespace Labels”kubectl get namespace cloudnova-lab --show-labelsExpected labels should include:
environment=developmentowner=cloud-security-teambusiness-unit=cloudnova-technologiesTask 13 — Create the Test Deployment
Section titled “Task 13 — Create the Test Deployment”Create a file named:
nginx-deployment.yamlAdd the following configuration:
apiVersion: apps/v1kind: Deploymentmetadata: name: cloudnova-web namespace: cloudnova-lab labels: app: cloudnova-web environment: developmentspec: replicas: 2 selector: matchLabels: app: cloudnova-web template: metadata: labels: app: cloudnova-web environment: development spec: containers: - name: nginx image: nginx:stable ports: - name: http containerPort: 80 protocol: TCP resources: requests: cpu: 100m memory: 64Mi limits: cpu: 250m memory: 128MiSecurity Controls Included
Section titled “Security Controls Included”This Deployment includes:
- A dedicated Namespace
- Workload labels
- Two replicas for availability
- CPU requests and limits
- Memory requests and limits
- A named container port
- No public Service exposure
Additional workload hardening will be introduced in later modules.
Step 1 — Apply the Deployment
Section titled “Step 1 — Apply the Deployment”PowerShell
Section titled “PowerShell”kubectl apply -f .\nginx-deployment.yamlGit Bash
Section titled “Git Bash”kubectl apply -f nginx-deployment.yamlExpected result:
deployment.apps/cloudnova-web createdStep 2 — Check Deployment Status
Section titled “Step 2 — Check Deployment Status”kubectl get deployments -n cloudnova-labExpected result:
NAME READY UP-TO-DATE AVAILABLEcloudnova-web 2/2 2 2Step 3 — Check the Pods
Section titled “Step 3 — Check the Pods”kubectl get pods -n cloudnova-labBoth Pods should show:
STATUS: RunningStep 4 — Display Pod Placement
Section titled “Step 4 — Display Pod Placement”kubectl get pods -n cloudnova-lab -o wideReview:
- Pod names
- Pod IP addresses
- Worker Node assignment
- Pod status
The application Pods should normally run on the Worker Node rather than the Control Plane.
Task 14 — Inspect the Deployment Hierarchy
Section titled “Task 14 — Inspect the Deployment Hierarchy”The Deployment creates a ReplicaSet, and the ReplicaSet creates Pods.
Step 1 — View the Deployment
Section titled “Step 1 — View the Deployment”kubectl get deployment cloudnova-web -n cloudnova-labStep 2 — View the ReplicaSet
Section titled “Step 2 — View the ReplicaSet”kubectl get replicasets -n cloudnova-labStep 3 — View the Pods
Section titled “Step 3 — View the Pods”kubectl get pods -n cloudnova-labThe relationship should be:
Deployment │ ▼ReplicaSet │ ├── Pod 1 └── Pod 2Step 4 — Inspect the Deployment
Section titled “Step 4 — Inspect the Deployment”kubectl describe deployment cloudnova-web -n cloudnova-labReview:
- Replicas
- Pod template
- Container image
- Resource settings
- Labels
- Events
Step 5 — Inspect One Pod
Section titled “Step 5 — Inspect One Pod”First, copy one Pod name from:
kubectl get pods -n cloudnova-labThen run:
kubectl describe pod <POD-NAME> -n cloudnova-labReplace <POD-NAME> with the real Pod name.
Review:
- Container image
- Container state
- Node placement
- Pod IP
- Resource limits
- Service Account
- Events
Task 15 — Create an Internal Kubernetes Service
Section titled “Task 15 — Create an Internal Kubernetes Service”Create a file named:
nginx-service.yamlAdd:
apiVersion: v1kind: Servicemetadata: name: cloudnova-web-service namespace: cloudnova-lab labels: app: cloudnova-webspec: type: ClusterIP selector: app: cloudnova-web ports: - name: http protocol: TCP port: 80 targetPort: 80Why ClusterIP?
Section titled “Why ClusterIP?”ClusterIP exposes the application only inside the Kubernetes cluster.
This reduces unnecessary public exposure.
Step 1 — Apply the Service
Section titled “Step 1 — Apply the Service”PowerShell
Section titled “PowerShell”kubectl apply -f .\nginx-service.yamlGit Bash
Section titled “Git Bash”kubectl apply -f nginx-service.yamlStep 2 — Verify the Service
Section titled “Step 2 — Verify the Service”kubectl get services -n cloudnova-labExpected result:
NAME TYPE CLUSTER-IP PORT(S)cloudnova-web-service ClusterIP ... 80/TCPStep 3 — Inspect the Service
Section titled “Step 3 — Inspect the Service”kubectl describe service cloudnova-web-service -n cloudnova-labReview:
- Service type
- Selector
- Cluster IP
- Port
- Target port
- Endpoints
Step 4 — Review Service Endpoints
Section titled “Step 4 — Review Service Endpoints”kubectl get endpoints -n cloudnova-labThe Service endpoints should correspond to the two Pod IP addresses.
Task 16 — Test the Application
Section titled “Task 16 — Test the Application”Because the Service is internal, use port forwarding for local testing.
Step 1 — Start Port Forwarding
Section titled “Step 1 — Start Port Forwarding”kubectl port-forward service/cloudnova-web-service 8080:80 -n cloudnova-labExpected output:
Forwarding from 127.0.0.1:8080 -> 80Keep this terminal open.
Step 2 — Open the Application
Section titled “Step 2 — Open the Application”Open a browser and visit:
http://localhost:8080You should see the default NGINX welcome page.
Step 3 — Stop Port Forwarding
Section titled “Step 3 — Stop Port Forwarding”Return to the terminal and press:
Ctrl + CSecurity Note
Section titled “Security Note”Port forwarding creates a temporary local connection.
It does not create a permanent public Kubernetes Service.
Task 17 — Validate Kubernetes Self-Healing
Section titled “Task 17 — Validate Kubernetes Self-Healing”You will delete one Pod and observe the ReplicaSet create a replacement.
Step 1 — List the Pods
Section titled “Step 1 — List the Pods”kubectl get pods -n cloudnova-labCopy one Pod name.
Step 2 — Delete One Pod
Section titled “Step 2 — Delete One Pod”kubectl delete pod <POD-NAME> -n cloudnova-labReplace <POD-NAME> with the selected Pod name.
Step 3 — Watch Kubernetes Recover
Section titled “Step 3 — Watch Kubernetes Recover”kubectl get pods -n cloudnova-lab --watchObserve:
- The selected Pod terminates
- A replacement Pod is created
- The replacement enters the
Runningstate
Press:
Ctrl + Cwhen the replacement Pod is ready.
Security and Resilience Observation
Section titled “Security and Resilience Observation”Kubernetes restored the desired number of replicas automatically.
This demonstrates:
- Self-healing
- Desired-state management
- ReplicaSet functionality
- Application resilience
Task 18 — Scale the Application
Section titled “Task 18 — Scale the Application”Step 1 — Scale to Three Replicas
Section titled “Step 1 — Scale to Three Replicas”kubectl scale deployment cloudnova-web --replicas=3 -n cloudnova-labStep 2 — Verify Scaling
Section titled “Step 2 — Verify Scaling”kubectl get deployment cloudnova-web -n cloudnova-labkubectl get pods -n cloudnova-labYou should now have three Pods.
Step 3 — Return to Two Replicas
Section titled “Step 3 — Return to Two Replicas”kubectl scale deployment cloudnova-web --replicas=2 -n cloudnova-labVerify:
kubectl get pods -n cloudnova-labTask 19 — Perform an Initial Security Review
Section titled “Task 19 — Perform an Initial Security Review”This is a foundational cluster rather than a fully hardened production environment.
Perform the following checks.
Check 1 — Confirm the Application Uses a Dedicated Namespace
Section titled “Check 1 — Confirm the Application Uses a Dedicated Namespace”kubectl get all -n cloudnova-labExpected result:
The application resources exist inside cloudnova-lab.
Check 2 — Confirm the Service is Not Public
Section titled “Check 2 — Confirm the Service is Not Public”kubectl get service cloudnova-web-service -n cloudnova-labExpected Service type:
ClusterIPThe Service should not be:
NodePortLoadBalancerCheck 3 — Confirm Resource Limits Exist
Section titled “Check 3 — Confirm Resource Limits Exist”kubectl get deployment cloudnova-web -n cloudnova-lab -o yamlLocate:
resources: requests: limits:Resource controls help reduce resource exhaustion risks.
Check 4 — Review the Default Service Account
Section titled “Check 4 — Review the Default Service Account”kubectl get serviceaccounts -n cloudnova-labExpected result:
defaultThe workload currently uses the default Service Account.
In production, dedicated Service Accounts should be created with minimum permissions.
Check 5 — Check Pod Security Context
Section titled “Check 5 — Check Pod Security Context”kubectl get deployment cloudnova-web -n cloudnova-lab -o yamlSearch for:
securityContextThe current Deployment does not yet contain a complete security context.
Record this as a security improvement opportunity.
Later modules will implement controls such as:
runAsNonRootallowPrivilegeEscalation: false- Read-only root filesystem
- Dropped Linux capabilities
- Seccomp profiles
Check 6 — Review Cluster Permissions
Section titled “Check 6 — Review Cluster Permissions”kubectl auth can-i --list -n cloudnova-labThis displays the actions your current identity can perform.
Because this is a local administrative lab cluster, your current context will likely have extensive permissions.
Production users should not receive unrestricted cluster administration permissions.
Check 7 — Review API Resources
Section titled “Check 7 — Review API Resources”kubectl api-resourcesObserve the number of Kubernetes resource types controlled through the API Server.
This demonstrates why API access must be protected.
Task 20 — Review Cluster Events
Section titled “Task 20 — Review Cluster Events”Cluster events help with troubleshooting and security investigations.
Namespace Events
Section titled “Namespace Events”kubectl get events -n cloudnova-lab --sort-by=.metadata.creationTimestampAll Namespace Events
Section titled “All Namespace Events”kubectl get events --all-namespaces --sort-by=.metadata.creationTimestampReview events related to:
- Pod scheduling
- Image pulling
- Container creation
- Pod termination
- Replica creation
- Scaling
Task 21 — Review Container Logs
Section titled “Task 21 — Review Container Logs”Step 1 — Get a Pod Name
Section titled “Step 1 — Get a Pod Name”kubectl get pods -n cloudnova-labStep 2 — Read Logs
Section titled “Step 2 — Read Logs”kubectl logs <POD-NAME> -n cloudnova-labReplace <POD-NAME> with a running Pod.
After accessing the application through port forwarding, the log may contain an HTTP request similar to:
GET / HTTP/1.1Step 3 — View Logs by Deployment
Section titled “Step 3 — View Logs by Deployment”kubectl logs deployment/cloudnova-web -n cloudnova-labLogs provide valuable information during troubleshooting and incident investigations.
Task 22 — Collect Lab Evidence
Section titled “Task 22 — Collect Lab Evidence”Capture evidence for the following items.
Evidence 01 — Tool Installation
Section titled “Evidence 01 — Tool Installation”docker versionkubectl version --clientkind versionEvidence 02 — Cluster
Section titled “Evidence 02 — Cluster”kind get clusterskubectl config current-contextkubectl cluster-infoEvidence 03 — Nodes
Section titled “Evidence 03 — Nodes”kubectl get nodes -o wideEvidence 04 — System Components
Section titled “Evidence 04 — System Components”kubectl get pods -n kube-system -o wideEvidence 05 — Namespace
Section titled “Evidence 05 — Namespace”kubectl get namespace cloudnova-lab --show-labelsEvidence 06 — Application Resources
Section titled “Evidence 06 — Application Resources”kubectl get all -n cloudnova-labEvidence 07 — Resource Configuration
Section titled “Evidence 07 — Resource Configuration”kubectl describe deployment cloudnova-web -n cloudnova-labEvidence 08 — Service
Section titled “Evidence 08 — Service”kubectl get service cloudnova-web-service -n cloudnova-labEvidence 09 — Running Application
Section titled “Evidence 09 — Running Application”Capture the NGINX page displayed at:
http://localhost:8080Evidence 10 — Self-Healing
Section titled “Evidence 10 — Self-Healing”Capture the replacement Pod created after deleting the original Pod.
Task 23 — Complete the Security Assessment
Section titled “Task 23 — Complete the Security Assessment”Create a file named:
initial-security-assessment.mdUse the following template:
# CloudNova Kubernetes Initial Security Assessment
## Environment
- Cluster name:- Cluster type:- Number of Control Plane nodes:- Number of Worker Nodes:- Kubernetes context:
## Implemented Controls
- Dedicated application Namespace:- Namespace labels:- Internal ClusterIP Service:- Resource requests:- Resource limits:- Multiple application replicas:- Control Plane workload separation:
## Identified Security Gaps
- Dedicated Service Account:- Pod security context:- Network Policy:- RBAC restrictions:- Image vulnerability scanning:- Runtime security monitoring:- Secrets management:- Audit logging review:
## Risk Summary
Describe the primary risks that would need to be addressed before this environment could be used for production workloads.
## Recommended Next Actions
1.2.3.4.5.
## Assessment Status
- Suitable for local learning:- Suitable for development:- Suitable for production:Suggested Assessment Conclusion
Section titled “Suggested Assessment Conclusion”Your conclusion should recognise that the cluster is:
Suitable for local learning and controlled development testing.It is not yet suitable for production because additional controls are required.
Task 24 — Clean Up the Application Resources
Section titled “Task 24 — Clean Up the Application Resources”Before deleting the complete cluster, remove the application resources individually.
Step 1 — Delete the Service
Section titled “Step 1 — Delete the Service”PowerShell
Section titled “PowerShell”kubectl delete -f .\nginx-service.yamlGit Bash
Section titled “Git Bash”kubectl delete -f nginx-service.yamlStep 2 — Delete the Deployment
Section titled “Step 2 — Delete the Deployment”PowerShell
Section titled “PowerShell”kubectl delete -f .\nginx-deployment.yamlGit Bash
Section titled “Git Bash”kubectl delete -f nginx-deployment.yamlStep 3 — Delete the Namespace
Section titled “Step 3 — Delete the Namespace”kubectl delete namespace cloudnova-labStep 4 — Confirm Removal
Section titled “Step 4 — Confirm Removal”kubectl get namespace cloudnova-labExpected result:
NotFoundTask 25 — Delete the Kubernetes Cluster
Section titled “Task 25 — Delete the Kubernetes Cluster”Step 1 — Delete the Cluster
Section titled “Step 1 — Delete the Cluster”kind delete cluster --name cloudnova-security-labExpected result:
Deleted nodes:cloudnova-security-lab-control-planecloudnova-security-lab-workerStep 2 — Confirm Cluster Removal
Section titled “Step 2 — Confirm Cluster Removal”kind get clustersThe cluster should no longer appear.
Step 3 — Confirm Docker Containers Were Removed
Section titled “Step 3 — Confirm Docker Containers Were Removed”docker psThe kind Control Plane and Worker Node containers should no longer be running.
Troubleshooting Guide
Section titled “Troubleshooting Guide”Issue 01 — Docker Command Not Found
Section titled “Issue 01 — Docker Command Not Found”Error:
docker is not recognizedResolution:
- Confirm Docker Desktop is installed.
- Restart the terminal.
- Restart Docker Desktop.
- Confirm Docker is included in the system
PATH.
Issue 02 — Docker Engine Is Not Running
Section titled “Issue 02 — Docker Engine Is Not Running”Error:
Cannot connect to the Docker daemonResolution:
- Start Docker Desktop.
- Wait for the engine to report that it is running.
- Run
docker versionagain.
Issue 03 — kind Command Not Found
Section titled “Issue 03 — kind Command Not Found”Error:
kind is not recognizedResolution:
- Close and reopen PowerShell.
- Confirm installation using
winget list. - Check whether the kind executable is in the system
PATH.
Issue 04 — Cluster Creation Fails
Section titled “Issue 04 — Cluster Creation Fails”Possible causes:
- Docker Desktop is not running
- Insufficient memory
- Virtualisation is disabled
- Previous cluster resources exist
- Security software is blocking Docker networking
Check:
docker pskind get clustersDelete a failed cluster:
kind delete cluster --name cloudnova-security-labThen retry:
kind create cluster --config kind-cluster.yamlIssue 05 — Nodes Show NotReady
Section titled “Issue 05 — Nodes Show NotReady”Check:
kubectl get nodeskubectl get pods -n kube-systemkubectl describe node cloudnova-security-lab-workerWait for system Pods to finish starting.
Docker Desktop may require additional CPU or memory.
Issue 06 — Pods Remain Pending
Section titled “Issue 06 — Pods Remain Pending”Check:
kubectl describe pod <POD-NAME> -n cloudnova-labReview the Events section for:
- Scheduling failures
- Resource shortages
- Image pull errors
- Node readiness issues
Issue 07 — ImagePullBackOff
Section titled “Issue 07 — ImagePullBackOff”Check:
kubectl describe pod <POD-NAME> -n cloudnova-labConfirm:
- Internet access is available
- Docker can reach the image registry
- The image name is correct
Issue 08 — Port 8080 Is Already in Use
Section titled “Issue 08 — Port 8080 Is Already in Use”Use another local port:
kubectl port-forward service/cloudnova-web-service 8081:80 -n cloudnova-labOpen:
http://localhost:8081Validation Checklist
Section titled “Validation Checklist”Confirm that you successfully completed the following:
- Verified hardware virtualisation
- Started Docker Desktop
- Verified Docker
- Installed or verified kubectl
- Installed kind
- Created the lab workspace
- Created the kind cluster configuration
- Built the Kubernetes cluster
- Verified the Control Plane and Worker Node
- Inspected Kubernetes system components
- Created the
cloudnova-labNamespace - Applied enterprise Namespace labels
- Deployed the NGINX application
- Verified two running Pods
- Created a ClusterIP Service
- Accessed the application using port forwarding
- Tested Kubernetes self-healing
- Scaled the Deployment
- Performed the initial security review
- Collected the required evidence
- Completed the security assessment
- Removed the application resources
- Deleted the Kubernetes cluster
Knowledge Check
Section titled “Knowledge Check”Question 1
Section titled “Question 1”What does kind use to create Kubernetes nodes?
- A. Physical servers
- B. Docker containers
- C. AWS Lambda functions
- D. Virtual private networks
Answer: B
Question 2
Section titled “Question 2”Which tool communicates with the Kubernetes API Server?
- A. Git
- B. Docker Compose
- C. kubectl
- D. Visual Studio Code
Answer: C
Question 3
Section titled “Question 3”Why was the application deployed into a dedicated Namespace?
- A. To make the image smaller
- B. To provide logical organisation and separation
- C. To replace the Worker Node
- D. To encrypt all network traffic
Answer: B
Question 4
Section titled “Question 4”Which Kubernetes object maintained the required number of application Pods?
- A. Service
- B. ConfigMap
- C. ReplicaSet
- D. Namespace
Answer: C
Question 5
Section titled “Question 5”Why was a ClusterIP Service selected?
- A. To expose the application publicly
- B. To provide an internal stable endpoint
- C. To create a Worker Node
- D. To store application data
Answer: B
Question 6
Section titled “Question 6”What happened when one Pod was deleted?
- A. The complete cluster stopped.
- B. Kubernetes created a replacement Pod.
- C. The Namespace was deleted.
- D. The Service became a LoadBalancer.
Answer: B
Question 7
Section titled “Question 7”Which identified security gap should be addressed in a later workload-hardening lab?
- A. Kubernetes does not support containers.
- B. The Deployment lacks a complete Pod security context.
- C. The cluster contains a Worker Node.
- D. The application uses a Service.
Answer: B
Skills Developed
Section titled “Skills Developed”By completing this lab, you practised:
- Kubernetes cluster provisioning
- Kubernetes command-line administration
- Control Plane inspection
- Worker Node inspection
- Namespace management
- Deployment management
- ReplicaSet inspection
- Pod troubleshooting
- Service configuration
- Port forwarding
- Self-healing validation
- Resource configuration review
- Basic Kubernetes security assessment
- Evidence collection
- Secure resource cleanup
Lab Summary
Section titled “Lab Summary”In this lab, you built your first Kubernetes cluster for CloudNova Technologies.
You created a two-node cluster containing a Control Plane and Worker Node, inspected the Kubernetes system components, deployed a containerised application, created an internal Service, validated self-healing, and completed an initial security review.
You also identified several controls that must be implemented before the cluster could support production workloads, including:
- Dedicated Service Accounts
- RBAC restrictions
- Pod security contexts
- Network Policies
- Image vulnerability scanning
- Runtime monitoring
- Secrets management
- Audit log analysis
This cluster-building experience provides the foundation for every Kubernetes security assessment, hardening activity, and incident investigation you will perform later in the learning path.
What’s Next?
Section titled “What’s Next?”In the next lab, you will deploy an application using stronger workload controls and begin applying security principles directly to Kubernetes resources.
➡️ Next Lab: Lab 02 — Deploy Your First Secure Application