Kubernetes is an advanced container orchestration platform used for automating deployment, scaling, and management of containerized applications. In this experiment, Kubernetes is implemented locally using k3d, a lightweight wrapper to run Kubernetes clusters inside Docker containers.
The experiment demonstrates real-world orchestration concepts including deployment, service exposure, scaling, and self-healing using a practical implementation.
k3d cluster create exp12cluster -p "30007:30007@loadbalancer"
kubectl get nodes
apiVersion: apps/v1
kind: Deployment
metadata:
name: webtest
spec:
replicas: 2
selector:
matchLabels:
app: webtest
template:
metadata:
labels:
app: webtest
spec:
containers:
- name: webtest
image: hashicorp/http-echo
args:
- "-text=Hello from Kubernetes"
ports:
- containerPort: 5678
kubectl apply -f nginx-deployment.yaml
kubectl get pods
apiVersion: v1
kind: Service
metadata:
name: webtest-service
spec:
type: NodePort
selector:
app: webtest
ports:
- port: 5678
targetPort: 5678
nodePort: 30007
kubectl apply -f nginx-service.yaml
Open browser: http://localhost:30007
kubectl delete pod <pod-name>
kubectl get pods
kubectl scale deployment webtest --replicas=4
kubectl get pods
The experiment successfully demonstrated Kubernetes orchestration using k3d. Core features such as deployment, scaling, and self-healing were validated. The system maintained desired state automatically and ensured application availability.