This Sample Project showcases how to use Pulumi Component Resource model to combine multiple Resources in Single Module.
This Project contains 2 Directories:
- Kubernetes-cluster: Component Resource to combine AWS VPC and AWS EKS calls.
- Application: Code to create AWS ECR repository, create Docker image from src code & deploy application to previously provisined EKS cluster.
.
├── README.md
├── application
│ ├── Pulumi.dev.yaml
│ ├── Pulumi.yaml
│ ├── index.ts
│ ├── node_modules
│ ├── package-lock.json
│ ├── package.json
│ ├── src
│ └── tsconfig.json
└── kubernetes-cluster
├── Pulumi.dev.yaml
├── Pulumi.yaml
├── index.ts
├── k8s.ts
├── kubeconfig.json
├── node_modules
├── package-lock.json
├── package.json
└── tsconfig.json
- Initialize Pulumi Stack
$ cd kubenetes-cluster
$ pulumi stack init dev
- Install node dependencies
$ npm install
- Set AWS region to deploy EKS
$ pulumi config set aws:region us-east-1
- Deploy cluster
$ pulumi up
- Once the CLuster is Deployed, you can get the Kubeconfig and verify the cluster access.
$ pulumi stack output kubeconfig >kubeconfig.json
$ KUBECONFIG=./kubeconfig.json kubectl get nodes
- Initialize Pulumi Stack
$ cd Application
$ pulumi stack init dev
- Install node dependencies
$ npm install
- Set AWS region to create ECR registry & Random value to print on App
$ pulumi config set aws:region us-east-1
$ pulumi config set app_value ronak
- Deploy Application
$ pulumi up
- Once the CLuster is Deployed, you can curl the Applicaion.
$ curl $(pulumi stack output url)