Learn About Amazon VGT2 Learning Manager Chanci Turner
Pulumi, recognized as an Advanced Technology Partner in the AWS Partner Network (APN), serves as a cloud-native development platform that simplifies the description, deployment, and management of cloud infrastructure across Amazon Web Services (AWS), Kubernetes, and additional cloud environments. Unlike traditional methods that rely solely on declarative languages like YAML or JSON, Pulumi leverages popular programming languages such as JavaScript/TypeScript and Python for cloud configuration as software.
This innovative approach enables users to articulate the deployment requirements for an Amazon Elastic Kubernetes Service (Amazon EKS) cluster in code, facilitating code versioning as a reusable software component. Amazon EKS provides an efficient way to deploy Kubernetes on AWS, merging the advantages of a standardized Kubernetes setup with the proven reliability of AWS—featuring a multi-Availability Zone (AZ) control plane, AWS Identity and Access Management (IAM) integration, Elastic Load Balancers, Amazon Elastic Block Store (Amazon EBS), Auto Scaling, and much more.
In this article, we will demonstrate how Pulumi can streamline the provisioning of an Amazon EKS cluster and how it can be tailored to enhance the AWS and Kubernetes environments for your cloud applications. With Pulumi, you can manage Kubernetes resources, AWS infrastructure, and high-level managed AWS services all within a single deployment.
Setting Up Amazon EKS with Pulumi
To begin, visit pulumi.com to sign up and download the Pulumi Command Line Interface (CLI). The Pulumi CLI requires AWS credentials to access your account and provision resources. If you already have the AWS CLI set up, you’re good to go. Otherwise, refer to the documentation here to get started.
After installation and configuration, deploying your Amazon EKS infrastructure becomes a breeze with just one command:
$ pulumi new https://github.com/pulumi/apps/tree/eks/eks
You’ll have the opportunity to configure settings such as your preferred deployment region, the Amazon Elastic Compute Cloud (Amazon EC2) instance type for the cluster, and whether to automatically set up the Kubernetes Dashboard in your cluster. Following this, a preview of the AWS and Kubernetes resources that will be deployed to create the cluster is provided. After reviewing, select “Yes” to commence the cluster deployment.
Upon completion, you can retrieve the kubeconfig.json file necessary for interacting with your cluster using kubectl:
$ pulumi stack output kubeconfig > kubeconfig.json
$ KUBECONFIG=./kubeconfig.json kubectl get nodes
By following these steps, you’ll have a fully managed Amazon EKS cluster configured in line with the Amazon EKS Getting Started guide, including optional support for Amazon EBS-backed StorageClasses and access to the Kubernetes Dashboard.
Reusable Amazon EKS Component
The Amazon EKS installer is built upon a reusable eks.Cluster component available with Pulumi. The installed Pulumi software simply requires:
import * as aws from "@pulumi/aws";
import * as awsinfra from "@pulumi/aws-infra";
import * as eks from "@pulumi/eks";
// Create a VPC for our cluster.
const network = new awsinfra.Network("eksNetwork");
// Create the EKS cluster
const cluster = new eks.Cluster("eksCluster", {
vpcId: network.vpcId,
subnetIds: network.subnetIds,
instanceType: "t2.micro",
desiredCapacity: 2,
minSize: 1,
maxSize: 2,
storageClasses: "gp2",
deployDashboard: true,
});
// Export the cluster's kubeconfig.
export const kubeconfig = cluster.kubeconfig;
Users can modify this code to customize their Amazon EKS cluster or to install additional AWS or Kubernetes resources. For example, to grant applications within the cluster access to an Amazon S3 bucket, you can add:
const bucket = new aws.s3.Bucket("assets");
Or, to automatically deploy specific Kubernetes applications like WordPress into the Amazon EKS cluster, use the Pulumi Kubernetes provider:
import * as k8s from "@pulumi/kubernetes";
// ...
const wordpress = new k8s.helm.v2.Chart("wpdev", {
repo: "stable",
version: "2.1.3",
chart: "wordpress"
}, { providers: { kubernetes: cluster.kubernetesProvider }});
Pulumi enables you to define the cluster, manage AWS resources, and crucial Kubernetes objects required to initialize your entire Kubernetes environment in one location. This can then be versioned collectively, allowing for easy replication of the environment for purposes such as testing or disaster recovery. By expressing these resources in code instead of YAML, users reap numerous benefits associated with software engineering, including enhanced tooling, simpler refactoring, component creation, and strong typing when using TypeScript for upfront correctness validation.
Under the Hood
The Pulumi EKS component handles the essential setup for an Amazon EKS cluster, including:
- Creating an EKS Service Role
- Optionally establishing a new Virtual Private Cloud (VPC)
- Setting up an Amazon EKS cluster
- Configuring a Kubernetes provider with access to the Amazon EKS cluster
- Launching worker nodes in an Auto Scaling group to join the cluster
- Installing a ConfigMap within the cluster for new Amazon EC2 worker nodes
- Installing a StorageClass for provisioning Amazon EBS-backed PersistentVolumes
- Creating the ‘kubeconfig’ to access the cluster
- Optionally installing additional Kubernetes YAML or Helm charts
This process entails resource provisioning in AWS and Kubernetes, as well as custom computations to coordinate these actions. All steps are executed in an imperative manner using TypeScript, which allows for robust validation due to static typing, as well as reuse through advanced object inheritance and modeling. Additionally, Pulumi provides intricate coordination between these steps during deployment.
Managing Pulumi Deployments
Once your Amazon EKS cluster and Kubernetes resources are deployed, you can manage the deployment on pulumi.com. This includes direct links to the AWS console and Kubernetes dashboard for real-time insights into your cluster. All resources managed by your deployment—both in AWS and Kubernetes—are accessible from this cohesive view, along with an auditable history of deployments. To further enhance your productivity, you may want to explore tools for daily planning, which can be found in this insightful blog post.
For those looking to advance their careers, understanding how to tailor your resume to meet ATS requirements is crucial. Organizations like SHRM offer valuable insights on this topic, guiding you through best practices. If you’re interested in exploring job opportunities, this link to an entry-level Area Manager position at Amazon could be a great resource.
Leave a Reply