Cluster Management
Cluster Lifecycle Management
Starting and Stopping Clusters
## Start Minikube cluster
minikube start
## Stop the cluster
minikube stop
## Delete the cluster
minikube delete
Multiple Cluster Profiles
graph TD
A[Cluster Profiles] --> B[Create Profile]
A --> C[Switch Profiles]
A --> D[Manage Profiles]
Profile Management
## Create a new cluster profile
minikube start -p development
## List all profiles
minikube profile list
## Switch between profiles
minikube profile development
Kubernetes Cluster Interaction
Kubectl Context Management
Command |
Description |
kubectl config get-contexts |
List available contexts |
kubectl config use-context minikube |
Switch to Minikube context |
kubectl cluster-info |
Display cluster information |
Cluster Addons Management
## List available addons
minikube addons list
## Enable an addon
minikube addons enable dashboard
## Disable an addon
minikube addons disable dashboard
Monitoring and Debugging
Cluster Diagnostics
## Check cluster status
minikube status
## View cluster logs
minikube logs
## Open Kubernetes dashboard
minikube dashboard
Advanced Cluster Operations
Networking and Tunneling
## Create a tunnel for services
minikube tunnel
## Expose services externally
kubectl expose deployment nginx --type=LoadBalancer
Resource Management
graph TD
A[Resource Management] --> B[Pod Scaling]
A --> C[Deployment Updates]
A --> D[Service Exposure]
Scaling and Updating Deployments
## Scale a deployment
kubectl scale deployment nginx --replicas=3
## Update deployment image
kubectl set image deployment/nginx nginx=nginx:latest
Persistent Storage
## Create persistent volume
kubectl apply -f - <<EOF
apiVersion: v1
kind: PersistentVolume
metadata:
name: example-pv
spec:
capacity:
storage: 5Gi
accessModes:
- ReadWriteOnce
EOF
Best Practices
Practice |
Recommendation |
Regular Updates |
Keep Minikube and kubectl updated |
Resource Limits |
Set appropriate CPU and memory |
Addon Management |
Enable only necessary addons |
On LabEx, users can practice these cluster management techniques to gain hands-on experience with Kubernetes cluster administration.