Manage Pods
In Kubernetes we can have clusters, if we run these commands they will target the default cluster. For more info about clusters you can look at cluster section
kubectl get pods -A # all namespaces kubectl get pods -n <namespace> # one namespace kubectl get pods -A -o wide # with node and IP kubectl get pods -A -w # watch for changes Cluster
A Kubernetes cluster is a set of machines/nodes that run your containerized workloads, managed as one unit. It has two parts:
- Control plane: the API server, scheduler, and etcd. It stores the desired state and decides which pod runs where.
- Worker nodes: the machines that run the pods, each with a kubelet and a container runtime.
You describe what you want (deployments, services), and the cluster keeps reality matching it.
kind ("Kubernetes IN Docker") creates a real cluster on your machine in which each node is a Docker container instead of a VM or physical server.
kind get clusters # Lists clusters kubectl config get-contexts # Return the current cluster which receive your kubectl commands kubectl config use-context kind-<cluster-name> # Select the desired cluster Note
The cluster name comes from
kind get clusters.
And in case you do not wanna change your context:
kubectl --context kind-<cluster-name> get pods -A Important
kubectlreads contexts from~/.kube/config, and if you haveminikubecontext it will be there too. But e.g. in smart-novel when you have a Terraform which start the app and project's start script writes the kind cluster'skubeconfigto its own file, so thekind-smart-novelcontext never reached your default config.kind get clustersstill lists the cluster becausekindfinds clusters through Docker, not throughkubeconfig.The fix is to point
kubectlat that file with--kubeconfig infra/terraform/envs/local/smart-novel-configorexport KUBECONFIG=.... Thekind-prefix added to the EKS context name was a separate mistake, since only kind-created contexts have it:kubectl --kubeconfig infra/terraform/envs/local/smart-novel-config get pods -A
- Ponos-OS: https://github.com/Ponos-OS
- My portfolio: https://kasir-barati.github.io

