|
3 tahun lalu | |
---|---|---|
.. | ||
.gitignore | 3 tahun lalu | |
Pulumi.dev.yaml | 3 tahun lalu | |
Pulumi.yaml | 3 tahun lalu | |
README.md | 3 tahun lalu | |
index.ts | 3 tahun lalu | |
k8sjs.ts | 3 tahun lalu | |
package.json | 3 tahun lalu | |
tsconfig.json | 3 tahun lalu |
This example deploys an EKS Kubernetes cluster with query node
To deploy your infrastructure, follow the below steps.
After cloning this repo, from this working directory, run these commands:
This installs the dependent packages needed for our Pulumi program.
$ npm install
This will initialize the Pulumi program in TypeScript.
$ pulumi stack init
Set the required AWS configuration variables in Pulumi.<stack>.yaml
Create a .env
file in this directory and set the database and other variables in it
Stand up the EKS cluster:
Running pulumi up -y
will deploy the EKS cluster. Note, provisioning a
new EKS cluster takes between 10-15 minutes.
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.
$ pulumi stack output kubeconfig --show-secrets > kubeconfig
$ export KUBECONFIG=$PWD/kubeconfig
$ kubectl get nodes
We can also use the stack output to query the cluster for our newly created Deployment:
$ kubectl get deployment $(pulumi stack output deploymentName) --namespace=$(pulumi stack output namespaceName)
$ kubectl get service $(pulumi stack output serviceName) --namespace=$(pulumi stack output namespaceName)
To get logs
$ kubectl config set-context --current --namespace=$(pulumi stack output namespaceName)
$ kubectl get pods
$ kubectl logs <PODNAME> --all-containers
To see complete pulumi stack output
$ pulumi stack output
To execute a command
$ kubectl exec --stdin --tty <PODNAME> -c colossus -- /bin/bash
Once you've finished experimenting, tear down your stack's resources by destroying and removing it:
$ pulumi destroy --yes
$ pulumi stack rm --yes