*** NOTICE: This course contains outdated information and has been deprecated ***
This course has been designed to teach you how to deploy and implement Google Cloud Platform solutions. The content in this course will help prepare you for the Associate Cloud Engineer exam.
- To learn how to deploy Kubernetes Engine resources on Google Cloud Platform
- To learn how to deploy and implement App Engine and Cloud Functions resources
- To learn how to use Cloud Launcher and Deployment Manager
- Those who are preparing for the Associate Cloud Engineer exam
- Those looking to learn more about GCP networking and compute features
To get the most from this course then you should have some exposure to GCP resources, such as Kubernetes Engine, App Engine, Cloud Functions, Cloud Launcher, and Deployment Manager. However, this is not essential.
Welcome back! In the previous lesson, I explained the process that you need to follow when deploying a containerized app to a GKE Cluster. In this demonstration, I'm going to show you how to perform the deployment.
What we're going to do here is deploy a containerized sample app, called "hello-app". It's a web app from the Google Container Registry.
Now before we get started, I need to use gcloud to configure to default settings: my default project and my compute zone. For this demonstration, I'm going to use my cloud academy project. And the compute zone I'm going to use is us-central1-a.
I should point out, that although configuring these two settings isn't mandatory, doing so makes it easier to run gcloud commands later on.
So, let's get started.
What I need to do here is launch cloud shell, so I can set my default project. So, we'll go ahead and launch it. What I'll do here is make it a little bit bigger, so we can see it here.
To set my default project, I need to run the gcloud config set command. So, I'll type this out here.
Now, I'm going to set the actually project I.D.. This sets my default project to my cloud academy project. Next, I need to set my default compute zone. To do this, I run the gcloud config set command. And then, what I'm going to do is set the compute zone. And I'm gonna specify us-central1-a. You can see here that it updated my compute zone as well. So, with my project and compute zone set, I can begin working on the deployment.
Before deploying anything, I need to get authentication credentials for my cluster. In this demo, I'm gonna to deploy to the cluster called "my GKE Cluster", which I created earlier in this course. To get my authentication credentials to interact with the cluster, I need to run gcloud container clusters to get credentials. So, lets type that out here. And then I need to specify my cluster. Now, what this command does is configure cube control to use the cluster that I created earlier.
At this point, I'm ready to deploy my containerized app. Now, as I mentioned earlier, I'm going to deploy a sample web application from the Google container registry. This app is called "hello app".
To run "hello-app" in my cluster, I need to use cube control run to create deployment. What I'm going to do here is just paste in the full command and then explain what's going on. This cube control one command creates a new deployment named "hello-server". The deployment's pod will then run the "hello-app" image in its container. The image flag specifies the container image to deploy. In this example, the image is being pulled from the Google container registry. The 1.O suffix specifies the image version to pull. The port flag is used to specify a port that the container needs to expose for the app to be accessible.
Now, hitting Enter here, launches the deployment. Now, after a few moments, you can see here the deployment is complete. But, I still have to expose it to the internet, so that users can get to it. This is done by creating a service that exposes the app to external traffic. To expose "hello app" to the world, I need to use the cube control expose command.
Now, I'm going to again copy this over because its a longer command. What this command does is create a compute engine load balancer for my container. And it does this via the "type" flag. The "port" flag initializes public port 80 to the internet. And the target port flag, routes inbound traffic to port 8080 of the application. So, we'll go ahead and hit enter here.
We can see here that it tells me that service hello-server is exposed. Now, to test my app deployment, I need to browse to it in a browser. However, I first need to find out what its public IP address is. To do this, I can run cube control get, and specify my deployment. Now, we can see here it's still pending an external IP address. So, we'll give this a few minutes for it to complete and get its IP. This can sometimes take a minute or two. I'll quickly re-run it again. And we can see that we've gotten an external IP now.
So, I'll copy this and with this external IP, I can browse to it in a browser and confirm that it works. So, I'll open up an incognito window here. And as you can see here on your screen, my app is in fact, working.
So, Congratulations! You now know how to deploy a containerized web application to GKE.
Tom is a 25+ year veteran of the IT industry, having worked in environments as large as 40k seats and as small as 50 seats. Throughout the course of a long an interesting career, he has built an in-depth skillset that spans numerous IT disciplines. Tom has designed and architected small, large, and global IT solutions.
In addition to the Cloud Platform and Infrastructure MCSE certification, Tom also carries several other Microsoft certifications. His ability to see things from a strategic perspective allows Tom to architect solutions that closely align with business needs.
In his spare time, Tom enjoys camping, fishing, and playing poker.