-
Notifications
You must be signed in to change notification settings - Fork 427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Demo Submission: Infrastructure as Software with Pulumi #1496
Conversation
Feedback for myself
|
FeedbackOverall impressionGreat work! You've chosen a project of which I have no prior knowledge. Still, you were able to explain the purpose of Pulumi that made your video being self-contained. Strengths
Weaknesses
Actionaable feedback
GradingI agree with the grading criteria aim that you state above |
Overall very nice demo! I especially liked the visuals and the way sections were split up. The step-by-step instructions are very comprehensive and easy to copy-paste. The actionable takeaway message would be a bit more clear if it had its own slide or a visual representation in the video. On a side note, I wasn't able to find any subtitles for the video, not sure if this is intentional or if they are just hard to find. |
Overall: The Demo is visually appeally and easy to follow. Also learnt about Pulunmi as an Infrastructure as code tool. Strength: The demonstration is original. Weakness 1. Would like to see a clear takeaway message. 2. Would prefer if the video is on youtube for easier access for others not participating in this course. |
FeedbackThe video sounds and appears very good. It summaries a more complex workflow in a short time and motivates me to try more. Your voice is very clear, sounds motivating and is never too fast.
|
@glidfeldt @sfkwww @IfyUrama @felix-seifert thank you for great feedback!
|
Demo Submission - Infrastructure as Software with Pulumi
Proposal PR: #1483.
Member
Name: Isak Hassbring (isakha@kth.se)
Github: hassbring
Motivation
Infrastructure as Code is great. There's just one problem - it's usually not code, but static files and domain-specific-languages that for large projects could be thousands and thousands of repetitive lines. E.g. Terraform requires HashiCorp Configuration Language (HCL), and Kubernetes' yaml-files does not leverage neither the power of traditional programming languages, nor the corresponding wide-spread know-how already out there.
Entering Pulumi! Pulumi is a cloud agnostic solution where you can use programming languages like Python, Go, and JavaScript to generate the static file infrastructure. You hence get access to familiar constructs like for loops, functions, and classes. This reduces boilerplate and enforce best practices. Instead of creating a new ecosystem of modules and sharing, Pulumi lets you leverage existing package management tools and techniques. Plus, you can automate and simply stuff in a cool way. Infrastructure as real code - or software.
Covered
Link
Vimeo: https://vimeo.com/547596905
Youtube (with subtitles): https://www.youtube.com/watch?v=ECyyqEHrsPk
Grading criteria aim
This is the grading that is aimed for.
pulumi destroy
!)Step by step with all code and setup needed (corresponding to "Code repo" - a better format in this particular case)
Intro
Hi! In this demo, I'll show you how to use Pulumi to deploy a cloud agnostic project using infrastructure as REAL code. Infrastructure as Code is great. There's just one problem - it's usually not code, but static files and domain-specific-languages that for large projects could be thousands and thousands of repetitive lines. E.g. Terraform requires HashiCorp Configuration Language (HCL) and Kubernetes YAML-files does not leverage neither the power of traditional programming languages, nor the wide-spread know-how already out there. Entering Pulumi! Pulumi is a cloud agnostic solution where you can use programming languages to generate the static file infrastructure. This reduces boilerplate and enforce best practices. Instead of creating a new ecosystem of modules and sharing, Pulumi lets you leverage existing package management tools and techniques. Plus, you can automate and simplify stuff in a cool way. Infrastructure as real code - or software.
Setting up
We can install Pulumi with
And login with
AWS S3
We'll start out with provisioning an AWS S3 bucket, add a simple web app to the bucket and serve the bucket as a website.
Configure AWS:
First we need an IAM AWS user. You can set that up on aws.com.
Then we need the AWS CLI.
Now lets make a project folder
and use the pulumi new command to create a new Pulumi AWS project.
We can use several programming languages. We'll go with Python and select
aws-python
.Lets check out the Pulumi program file. It creates a new S3 bucket and exports the name of the bucket. Simple as that!
We update and deploy using
pulumi up
. Pulumi tells us which resources have been updated. We move on withyes
. Now our bucket is provisioned.Lets modify it and add an html file.
We add a new bucket object to our Pulumi program.
We run
pulumi up
and select yes.Finally verify that the object was created in the bucket.
And thats it for AWS! Let's clean up and destroy our resources.
Kuberenetes
Next up is Kubernetes with Minikube.
Prerequisites:
Create a new folder
Start your cluster and check that kubectl is configured to use "minikube" cluster and "default" namespace by default.
Get the cluster state. If you see a URL-response, kubectl is configured correctly.
and a new project, select default values and then yes.
Deploy the stack and select yes. This will create resources in Kubernetes.
Let’s examine the Pulumi program that defines our stack resources. This Pulumi program creates an NGINX deployment and exports the name of the deployment.
We run pulumi up to instruct Pulumi to determine the resources needed to create the stack. First, a preview is shown of the changes that will be made. Select yes to create the resources in Kubernetes. Then, the name of the deployment that we exported is shown as a stack output.
Now lets go ahead and deploy some changes.
Tell kubernetes to only create services of type ClusterIP
Deploy the changes
We now have an ip stack output that we can curl to get the output from the service. We can normally run
curl $(pulumi stack output ip)
since Minikube does not support type LoadBalancer we have to take a little detour.curl $(pulumi stack output ip)
in a separate shell or open in browser.We're done! Lets now destroy the stack.
Finally, stop minikube
Pulumi managed Kubernetes cluster on GCP (Google Cloud Platform) GKE (Google Kubernetes Engine).
Let us create the standard Kubernetes Guestbook manifests in Pulumi using the Guestbook YAML manifests. We take the additional steps of transforming its properties to use the same Namespace and metadata labels that the NGINX stack uses, and also make its frontend service use a LoadBalancer typed Service to expose it publicly.
Prerequisites:
GCP stuff
Install the Google Cloud SDK
Press Y to update your
$PATH
and enable shell command completion. Then restart the shellAuthenticate with the Google Cloud SDK.
Come up with a unique project name and replace <proj-id> with your project name below.
Config account
If you haven't installed it, install the kubernetes cli as part of the Google Cloud SDK
Go to the GCP Console API Library and enable the Kubernetes Engine API to your project. You will need a credit card but it won't cost anything.
Node
Create a new project and press enter three times.
Add required dependencies
Configure Pulumi with GCP project and location zone. Replace <proj-id> with your project name. You can run
gcloud info
to see it.Now we'll declare the resources we want in GCP to provision the GKE cluster as well as the kubeconfig file to access the cluster, and lastly the initialization of a Pulumi Kubernetes provider. To do this, we replace the contents of
index.ts
, the main entrypoint of our Pulumi program, with the code below.Running pulumi up will deploy the GKE cluster, which takes a couple of minutes.
Click the FQDN listed in guestbookPublicIP and behold - the guestbook! Try using another device!
ACTIONABLE TAKE AWAY: As allways when we're done, destroy the stack and clean up.