Kubernetes Commands (13-29 )
Preethi Dovala
Vice President at JPMorgan Chase & Co. | Certified Kubernetes Application Developer(CKAD) | HashiCorp Certified Terraform Associate |Freelance Devops Instructor| AWS Certified Solutions Architect
13. kubectl expose deployment my-deployment --port=8080 --target-port=80 --type=LoadBalancer? ?
- Output: The my-deployment deployment is exposed as a LoadBalancer service on port 8080. ?- Explanation: Creates a service of type LoadBalancer that exposes the my-deployment deployment on port 8080, forwarding traffic to port 80 of the pods.
?
14. kubectl create namespace my-namespace
? - Output: The my-namespace namespace is created. ? ?
- Explanation: Creates a new namespace called my-namespace.
?
15. kubectl get namespaces ?
? - Output: A list of namespaces in the cluster. ? ?
- Explanation: Lists all the namespaces available in the cluster.
?
16. kubectl describe namespace my-namespace
? - Output: Detailed information about the my-namespace namespace. ? ?
- Explanation: Retrieves detailed information about the my-namespace namespace, including its status and resource limits.
?
17. kubectl delete namespace my-namespace
? - Output: The my-namespace namespace is deleted. ? ?
- Explanation: Deletes the my-namespace namespace and all its associated resources.
?
18. kubectl create configmap my-config --from-file=config.ini
? - Output: The my-config ConfigMap is created. ? ?
- Explanation: Creates a ConfigMap called my-config using the contents of the config.ini file.
?
19. kubectl get configmaps: ?
- Output: A list of ConfigMaps in the default namespace. ? ?
- Explanation: Lists all the ConfigMaps available in the default namespace.
?
20. kubectl describe configmap my-config ? ?
- Output: Detailed information about the my-config ConfigMap. ? ?
- Explanation: Retrieves detailed information about the my-config ConfigMap, including its data and associated pods.
?
21. kubectl delete configmap my-config ? ?
- Output: The my-config ConfigMap is deleted. ? ?
领英推荐
- Explanation: Deletes the my-config ConfigMap.
?
22. kubectl create secret generic my-secret --from-literal=password=abc123 ? ?
- Output: The my-secret Secret is created. ? ?
- Explanation: Creates a Secret called my-secret with the key password and the value abc123.
?
23. kubectl get secrets ? ?
- Output: A list of secrets in the default namespace. ? ?
- Explanation: Lists all the secrets available in the default namespace.
?
24. kubectl describe secret my-secret? ?
- Output: Detailed information about the my-secret Secret. ? ?
- Explanation: Retrieves detailed information about the my-secret Secret, including its type and data.
?
25. kubectl delete secret my-secret ? ?
- Output: The my-secret Secret is deleted. ? ?
- Explanation: Deletes the my-secret Secret.
?
26. kubectl create ingress my-ingress --rule=my-domain.com/path=my-service:8080 ? ?
- Output: The my-ingress Ingress is created. ? ?
- Explanation: Creates an Ingress called my-ingress that routes traffic from my-domain.com/path to the my-service service on port 8080.
?
27. kubectl get ingresses ? ?
- Output: A list of ingresses in the default namespace. ? ?
- Explanation: Lists all the ingresses available in the default namespace.
?
28. kubectl describe ingress my-ingress? ?
- Output: Detailed information about the my-ingress Ingress. ? ?
- Explanation: Retrieves detailed information about the my-ingress Ingress, including its rules and backend services.
?
29. kubectl delete ingress my-ingress ? ?
- Output: The my-ingress Ingress is deleted. ? ?
- Explanation: Deletes the my-ingress Ingress.