WebHosting

Wednesday, September 6, 2023

#KUBERNETES #CHEATSHEET



 ------------------------------------------

|                  KUBERNETES CHEAT SHEET                     |

-------------------------------------------

**Kubernetes Architecture:**

1. **Node Components:**

   - kubelet: Node agent managing containers.

   - kube-proxy: Maintains network rules on nodes.

   - Container Runtime: Docker, containerd, or others.

2. **Control Plane Components:**

   - kube-apiserver: Exposes the Kubernetes API.

   - etcd: Consistent and highly-available key-value store.

   - kube-controller-manager: Manages controllers.

   - kube-scheduler: Assigns nodes to pods.

**Kubectl Basics:**

3. **Cluster Information:**

   - `kubectl cluster-info`: Display cluster information.

   - `kubectl get nodes`: List nodes in the cluster.

4. **Working with Pods:**

   - `kubectl get pods`: List pods in the default namespace.

   - `kubectl describe pod <pod-name>`: Show pod details.

   - `kubectl exec -it <pod-name> -- /bin/bash`: Access pod shell.

   - `kubectl logs <pod-name>`: View pod logs.

5. **Creating Resources:**

   - `kubectl apply -f <yaml-file>`: Create or update resources.

   - `kubectl delete -f <yaml-file>`: Delete resources.

**Kubernetes Resources:**

6. **Deployments:**

   - `kubectl get deployments`: List deployments.

   - `kubectl scale deployment <deployment-name> --replicas=<count>`: Scale a deployment.

7. **Services:**

   - `kubectl get services`: List services.

   - `kubectl expose deployment <deployment-name> --port=<port>`: Create a service.

8. **ConfigMaps and Secrets:**

   - `kubectl create configmap <configmap-name> --from-file=<file>`: Create a ConfigMap.

   - `kubectl create secret generic <secret-name> --from-literal=<key>=<value>`: Create a secret.

**Managing Resources:**

9. **Namespace:**

   - `kubectl get namespaces`: List namespaces.

   - `kubectl create namespace <namespace-name>`: Create a namespace.

10. **Labeling and Selectors:**

    - `kubectl label <resource-type> <resource-name> <key>=<value>`: Add labels.

    - `kubectl get <resource-type> -l <key>=<value>`: Select by label.

11. **Resource Quotas and Limits:**

    - `kubectl describe resourcequota <resourcequota-name>`: View resource quotas.

    - `kubectl describe pod <pod-name>`: View resource limits.

**Kubernetes Networking:**


12. **Services and Ingress:**

    - `kubectl get svc -n <namespace>`: List services in a namespace.

    - `kubectl get ingress -n <namespace>`: List ingress resources.

13. **Networking Policies:**

    - Define network policies to control pod-to-pod communication.

**Kubernetes Advanced Topics:**

14. **StatefulSets:**

    - `kubectl get statefulsets`: List StatefulSets.

    - Manages stateful, ordered deployment of pods.

15. **DaemonSets:**

    - `kubectl get daemonsets`: List DaemonSets.

    - Ensures a copy of a pod runs on all or some nodes.

**Kubernetes Monitoring and Logging:**

16. **Monitoring with Prometheus:**

    - Set up Prometheus for monitoring cluster metrics.

17. **Logging with Fluentd:**

    - Implement Fluentd for log collection.

**Additional Resources:**

18. **Official Kubernetes Documentation:**

    - [Kubernetes Official Documentation](https://kubernetes.io/docs/home/)

19. **Kubernetes Community:**

    - [Kubernetes GitHub](https://github.com/kubernetes)

    - [Kubernetes Community](https://kubernetes.io/community/)

20. **Kubernetes Forums and Support:**

    - [Kubernetes Stack Overflow](https://stackoverflow.com/questions/tagged/kubernetes)

    - [Kubernetes Reddit](https://www.reddit.com/r/kubernetes/)



No comments:

Post a Comment

Thank you for Commenting Will reply soon ......

Featured Posts

How to Enable and Configure Remote Desktop (RDP) on Ubuntu 24.04.4 LTS

Remote Desktop Protocol (RDP) support in Ubuntu has become considerably easier with the GNOME Remote Desktop stack included in modern Ubuntu...