Skip to main content

astroctl infra kubernetes generate-kubeconfig

Generate kubeconfig for Kubernetes clusters

Synopsis​

Generate your kubeconfig for a Kubernetes cluster managed by AstroPulse and switch kubectl to it.

The kubeconfig works the same on every cluster (EKS, GKE, AKS, registered): it holds no credential and needs no cloud tool or cloud login. kubectl runs astroctl infra k8s access-token to get a short-lived token, and again when it expires, until the lifetime you choose with --duration ends. Then access-token answers "This kubeconfig expired" and you generate a new one.

A self-hosted cluster's kubeconfig carries its own client certificate with the lifetime you choose; it is generated in the background.

With --native, the kubeconfig instead signs in with your own cloud identity through your cloud provider's tool: the AWS CLI on EKS, gke-gcloud-auth-plugin on GKE, kubelogin on AKS. It holds no AstroPulse credential, and astroctl prints what it needs: the tool, and your identity's access to the cluster (an EKS access entry, an IAM role on the GKE project, an Azure RBAC role).

Terminal
astroctl infra kubernetes generate-kubeconfig [cluster-name] [flags]

Examples​

Terminal

# Generate a kubeconfig valid for 12 hours
astroctl infra k8s generate-kubeconfig --cluster-name my-cluster --duration 12h

# Sign in with your own cloud identity and your cloud provider's tool instead
astroctl infra k8s generate-kubeconfig --cluster-name my-cluster --native

Options​

Terminal
-c, --cluster-name string cluster name
--duration string how long the kubeconfig works: one of 1h, 4h, 12h, 24h (default "1h")
-h, --help help for generate-kubeconfig
--native sign in with your own cloud identity through your cloud provider's tool instead of astroctl

Options inherited from parent commands​

Terminal
-o, --output string Output format (table|json|yaml) (default "table")

SEE ALSO​