Skip to main content

Introduction

The Astro Platform offers a simple API to dynamically generate and retrieve the kubeconfig for any managed Kubernetes cluster, allowing you to access and manage the cluster using the kubectl CLI. The generated kubeconfig includes an expiration date, whether it is token-based or mutual TLS-based. To obtain the kubeconfig for a cluster, you can execute the astroctl clusters command. This command requires either the platform admin or admin role to successfully fetch the kubeconfig. This process applies to both managed and self-hosted clusters.

Self Hosted Provisioner

For selfHosted provisioner, you can run the following command to get the kubeconfig for a cluster, you need to first generate the kubeconfig with platform admin or admin role, and then set the context to the cluster.

astroctl clusters generate-kubeconfig <cluster-name>

and then set the context to the cluster.

astroctl clusters set-context <cluster-name>

This command will update your local ~/.kube/config file to include the new context. The default duration for the kubeconfig is 1 hour, you can specify the duration by using the --duration flag.

EKS provisioner

For EKS clusters, you can run the following command to export the kubeconfig to your local ~/.kube/config file.

astroctl clusters set-context <cluster-name>
Expired Kubeconfig

For EKS clusters, the kubeconfig is valid for 1 hours. If the kubeconfig is expired, you need to set the context again by running the above command.

Also, for some reson you want to delete the kubeconfig from your local ~/.kube/config file, you can run the following command to delete the kubeconfig for a cluster.

astroctl clusters delete-context <cluster-name>

This command will delete the kubeconfig for a cluster from your local ~/.kube/config file.