[TIL] Useful k3d and kubectl commands
Listing some useful k3d and kubectl commands I’ve been using lately.
k3d
Create cluster
k3d cluster create my-clusterCreate cluster with load balancer and respective port binding (useful for testing locally)
k3d cluster create my-cluster -p "80:30000@loadbalancer"Create cluster without load balancer
k3d cluster create --no-lbCreate cluster with specified number of control planes and worker nodes
k3d cluster create my-cluster --servers 3 --agents 3List clusters
k3d cluster listDelete cluster
k3d cluster listkubectl
List all supported resource types (useful to know which version to use when writing manifests)
kubectl api-resourcesGet list of nodes in the cluster
kubectl get nodesApply resources specified in a manifest file
kubectl apply -f pod.yamlGet Pods
kubectl get podsGet Pod details (useful to know which image tag/version is running)
kubectl describe pod my-podPort bind Pod port to localhost port
kubectl port-forward pod/conversao-temperatura 8080:8080Delete Pod
kubectl delete pod conversao-temperaturaDelete resources specified in a manifest file
kubectl delete -f pod.yaml