1. Docs
  2. Infrastructure as Code
  3. Get Started
  4. Kubernetes
  5. Configure access

Get started with Pulumi and Kubernetes

    Configure access to Kubernetes

    Pulumi’s CLI needs access to a Kubernetes cluster to manage cloud resources.

    You must have access to a Kubernetes cluster—either a local cluster (such as Minikube, kind, or Docker Desktop) or a cloud-managed cluster (such as GKE, AKS, or EKS).

    You also need kubectl installed and configured to access your cluster.

    Testing access

    To test that your Kubernetes cluster access is configured properly, run:

    $ kubectl cluster-info
    
    > kubectl cluster-info
    

    If your cluster’s control plane and services are printed, your configuration is correct. If not, read on:

    Kubernetes control plane is running at https://127.0.0.1:6443
    CoreDNS is running at https://127.0.0.1:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
    

    You can also verify you have access to cluster resources:

    $ kubectl get nodes
    $ kubectl auth can-i get pods
    
    > kubectl get nodes
    > kubectl auth can-i get pods
    

    How Pulumi accesses your cluster

    Pulumi uses the same kubeconfig file that kubectl uses (typically ~/.kube/config). If you can run kubectl get nodes, Pulumi will work automatically.

    You can verify which context Pulumi will use:

    $ kubectl config current-context
    
    > kubectl config current-context
    

    Alternative approaches

    If you need to use a specific kubeconfig file or context, you can set:

    $ export KUBECONFIG="$HOME/path/to/kubeconfig"
    
    > $env:KUBECONFIG = "C:\path\to\kubeconfig"
    

    Or specify the context in your Pulumi stack configuration:

    $ pulumi config set kubernetes:context my-cluster-context
    
    > pulumi config set kubernetes:context my-cluster-context
    

    For detailed information on Pulumi’s use of Kubernetes credentials, see Kubernetes Setup.

      Neo just got smarter about infrastructure policy automation