K8S: Gerando Kubeconfig para AWS EKS

Aprenda a gerar o kubeconfig para um cluster EKS

Gerando Kubeconfig para AWS EKS

configurando aws-cli

$ aws configure
    
preencha os dados pedidos

AWS Access Key ID [None]: ACCESS_KEY
AWS Secret Access Key [None]: SECRET_KEY
Default region name [None]: us-east-1
Default output format [None]: json

listando clusters

$ aws eks cluster-list --output table

saída

-----------------------
|    ListClusters     |
+---------------------+
||     clusters      ||
|+-------------------+|
||  homologacao      ||
||  producao         ||
||  desenvolvimento  ||
||  sandbox          ||
|+-------------------+|


gerando

$ aws eks update-kubeconfig --name labs

saída

Added new context arn:aws:eks:us-east-1:xxxx:cluster/gr1d-labs to /Users/gutocarvalho/projetos/nativetrail/k8s/labs/config

listando clusters

$ export KUBECONFIG=/Users/gutocarvalho/projetos/nativetrail/k8s/labs/config
$ kubectl get nodes

saída

NAME                            STATUS   ROLES    AGE   VERSION
ip-172-xx-xx-11.ec2.internal     Ready    <none>   24m   v1.21.2-eks-55daa9d
ip-172-xx-xx-168.ec2.internal    Ready    <none>   24m   v1.21.2-eks-55daa9d
ip-172-xx-xx-198.ec2.internal    Ready    <none>   24m   v1.21.2-eks-55daa9d

prontinho!