I'm new to Kubernetes and was following some examples for setting contexts. Now I can't seem to get any objects on my server, or I'm talking to the wrong server. I see...
$ kubectl config view
apiVersion: v1
clusters:
- cluster:
server: ""
name: sandbox
- cluster:
certificate-authority-data: DATA+OMITTED
server: https://redacted.gr7.us-east-1.eks.amazonaws.com
name: sandbox.us-east-1.eksctl.io
contexts:
- context:
cluster: sandbox.us-east-1.eksctl.io
user: me@company.com@sandbox.us-east-1.eksctl.io
name: me@company.com@sandbox.us-east-1.eksctl.io
- context:
cluster: sandbox
namespace: kube-system
user: ""
name: sandbox
current-context: sandbox
kind: Config
preferences: {}
users:
- name: me@company.com@sandbox.us-east-1.eksctl.io
user:
exec:
apiVersion: client.authentication.k8s.io/v1alpha1
args:
- token
- -i
- sandbox
command: aws-iam-authenticator
env:
- name: AWS_STS_REGIONAL_ENDPOINTS
value: regional
- name: AWS_DEFAULT_REGION
value: us-east-1
I see the cluster in AWS EKS, and see pods, deployments, etc. But when I do the following
$ kubectl get pods -A
error: the server doesn't have a resource type "pods"
$ kubectl get nodes -A
error: the server doesn't have a resource type "nodes"
What gives?
Your current context is sandbox
, try changing the current-context with kubectl or directly in ~/.kube/config
.
$ kubectl config get-contexts
$ kubectl config use-context me@company.com@sandbox.us-east-1.eksctl.io