Skip to main content

Minimal EKS cluster (in Java)

A minimal example of using pulumi-eks

This example lives in the pulumi/examples repository. Check out just this directory to use it:

Get started with this example
git clone --filter=blob:none --sparse https://github.com/pulumi/examples pulumi-examples
git -C pulumi-examples sparse-checkout set aws-java-eks-minimal
cd pulumi-examples/aws-java-eks-minimal

This example demonstrates consuming Pulumi AWS EKS Components from Java.

The high-level Cluster component automatically provisions roles, security groups and other necessary resources with good defaults, making it easy to get started. For more information, checkout the relevant Pulumi blog.

Prerequisites#

  1. Install Pulumi
  2. Configure AWS credentials
  3. Install Java

Deploying the example#

  1. Create a new stack:

    Terminal window
    pulumi stack init dev
  2. Set the AWS region to deploy into:

    Terminal window
    pulumi config set aws:region us-east-1
  3. Deploy the example. Note it will take up to 10 minutes to provision the EKS cluster:

    Terminal window
    pulumi up
  4. Access the Kubernetes cluster using kubectl.

    To access your new Kubernetes cluster using kubectl, we need to set up the kubeconfig file and download kubectl. We can leverage the Pulumi stack output in the CLI, as Pulumi facilitates exporting these objects for us.

    Terminal window
    pulumi stack output kubeconfig --show-secrets > kubeconfig
    export KUBECONFIG=$PWD/kubeconfig
    kubectl version
    kubectl cluster-info
    kubectl get nodes

Cleaning up#

Once you’re finished experimenting, you can destroy your stack and remove it to avoid incurring any additional cost:

Terminal window
pulumi destroy
pulumi stack rm

Related

The infrastructure as code platform for any cloud.