Kubernetes Key Commands Map

Listen to this Post

Covering aspects of:

1. Pod Management

2. Cluster Management

3. Service Management

4. Resource Monitoring

5. Namespace Management

6. Deployment Management

7. Configuration and Secrets

You Should Know:

Here are some essential Kubernetes commands and steps to manage your clusters effectively:

1. Pod Management

  • Create a Pod:
    kubectl run nginx-pod --image=nginx
    
  • List Pods:
    kubectl get pods
    
  • Describe a Pod:
    kubectl describe pod <pod-name>
    
  • Delete a Pod:
    kubectl delete pod <pod-name>
    

2. Cluster Management

  • Check Cluster Info:
    kubectl cluster-info
    
  • Get Nodes:
    kubectl get nodes
    
  • Drain a Node (for maintenance):
    kubectl drain <node-name> --ignore-daemonsets --delete-emptydir-data
    

3. Service Management

  • Expose a Deployment as a Service:
    kubectl expose deployment <deployment-name> --type=LoadBalancer --port=80
    
  • List Services:
    kubectl get services
    

4. Resource Monitoring

  • Check Resource Usage:
    kubectl top nodes
    kubectl top pods
    

5. Namespace Management

  • Create a Namespace:
    kubectl create namespace <namespace-name>
    
  • Switch Namespace:
    kubectl config set-context --current --namespace=<namespace-name>
    

6. Deployment Management

  • Create a Deployment:
    kubectl create deployment <deployment-name> --image=nginx
    
  • Scale a Deployment:
    kubectl scale deployment <deployment-name> --replicas=3
    

7. Configuration and Secrets

  • Create a ConfigMap:
    kubectl create configmap <configmap-name> --from-literal=key=value
    
  • Create a Secret:
    kubectl create secret generic <secret-name> --from-literal=username=admin --from-literal=password=secret
    

What Undercode Say:

Kubernetes is a powerful tool for managing containerized applications, and mastering its commands is essential for efficient cluster management. Whether you’re managing pods, services, or deployments, these commands will help you streamline your workflow. For further reading, check out the official Kubernetes documentation: Kubernetes Docs.

Additional Linux/IT Commands:

  • Check Disk Usage:
    df -h
    
  • Monitor System Processes:
    top
    
  • List Open Ports:
    netstat -tuln
    
  • Check Network Connectivity:
    ping <hostname-or-ip>
    
  • Search for Files:
    find /path/to/search -name "filename"
    

Mastering these commands will enhance your IT and Kubernetes expertise. Keep practicing!

References:

Reported By: Govardhana Miriyala – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass ✅

Join Our Cyber World:

💬 Whatsapp | 💬 TelegramFeatured Image