Kubernetes - View kube config using kubectl

by
Jeremy Canfield |
Updated: November 01 2023
| Kubernetes articles
The aws eks list-clusters command can be used to list your Elastic Kubernetes Service (EKS).
~]$ aws eks list-clusters
{
"clusters": [
"my-cluster"
]
}
And then the aws eks update-kubeconfig command can be used to create or update your hidden .kube/config file. By default, the hidden .kube config file will be created at /home/your_username/.kube/config.
~]$ aws eks update-kubeconfig --name my-cluster
Added new context arn:aws:eks:us-east-1:123456789012:cluster/my-cluster to /home/john.doe/.kube/config
The kubectl config view command should be nearly identical to the content of your hidden .kube config file.
~]$ kubectl config view
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: DATA+OMITTED
server: https://123456789ABDEFG123456789.gr7.us-east-1.eks.amazonaws.com
name: arn:aws:eks:us-east-1:123456789012:cluster/my-cluster
contexts:
- context:
cluster: arn:aws:eks:us-east-1:123456789012:cluster/my-cluster
user: arn:aws:eks:us-east-21:123456789012:cluster/my-cluster
name: arn:aws:eks:us-east-1:123456789012:cluster/my-cluster
current-context: arn:aws:eks:us-east-1:123456789012:cluster/my-cluster
kind: Config
preferences: {}
users:
- name: arn:aws:eks:us-east-1:123456789012:cluster/my-cluster
user:
exec:
apiVersion: client.authentication.k8s.io/v1alpha1
args:
- --region
- us-east-1
- eks
- get-token
- --cluster-name
- my-cluster
command: aws
env:
- name: AWS_PROFILE
value: john_doe
interactiveMode: IfAvailable
provideClusterInfo: false
Did you find this article helpful?
If so, consider buying me a coffee over at