Currently I'm using microk8s to run local cluster.
When I run k get pods -A
, this result shown
...
kube-system kubernetes-dashboard-7ffd448895-56tlr 1/1 Running 1 3d14h
...
Ok.. It means there's a pod kubernetes-dashboard running in kube-system namespace.
And I tried to port forward that pod 443 into 10443 and this result shows up
$ k port-forward kubernetes-dashboard-7ffd448895-56tlr 10443:443
Error from server (NotFound): pods "kubernetes-dashboard-7ffd448895-56tlr" not found
I mean, there it is. The pod is there. But it keeps denying it.
I don't understand this result and stuck with no progress.
How can I port-forward my pods?
The result of k get pods -A
indicates that the pod is in the namespace kube-system
. Unless a resource is in the default namespace, you must specify the namespace:
k port-forward -n kube-system kubernetes-dashboard-7ffd448895-56tlr 10443:443
Alternatively, you can update your context to use a different namespace by default:
kubectl config set-context --current --namespace=kube-system
After you do that you can work with resources in kube-system
without setting -n kube-system
.