Defining Development Environments
Working with Kubernetes Locally
Integrating GCP into our Development Workflow
Deploying to Google Cloud Platform
In this course, we will explore some of the tools available to build and manage development environments intended for deployment on Google Cloud Platform products. We will also demonstrate how to easily push builds from our local machine to Google-hosted services.
We will start the course by covering the different types of development environments and their purposes. We will touch briefly on popular software methodologies and frameworks as they relate to choices in number and type of development environments.
This course will focus on container-based application development environments, tools, and services. We will first walk through installing and using Docker and Kubernetes on your local machine. Then we will explore how to push projects to Google Cloud Run and Google Kubernetes Engine.
Writing applications using Kubernetes or Cloud Run can be further streamlined with Google Cloud Code, which provides direct IDE support for development on these platforms. We will examine how to install and use Google Cloud Code with Visual Studio Code.
- Understand the types of development environments and when to use them
- Install a container-based local development environment
- Add Google Cloud Code support to VS Code
- Push code from a local development environment and run on Google Cloud Platform using:
- Google Cloud Run
- Google Kubernetes Engine
- Google Deployment Manager
- Programmers interested in developing containerized applications on Google Cloud Platform
- Solo developers new to working on a development team
- Anyone preparing for the Google Professional Cloud DevOps Engineer certification
To get the most out of this course, you should:
- Have a Google Cloud Platform account
- Have Google Cloud SDK installed and initialized
- Be familiar with IAM role management for GCP resources
- Have Visual Studio Code, Python 3, and Git installed
Knowledge of Python would also be beneficial for scripting with GCP, but it's not essential.
In the last video, we got Google Cloud Code installed and authenticated in Visual Studio Code. Let’s see how much easier it is for us to develop a Kubernetes application using our new tools now.
First thing, we can see we don’t have any clusters available in our Kubernetes Explorer. Let’s make sure minikube is running before we go any further so we can deploy our app to a cluster locally for development. Cloud Code utilizes its own instance of minikube inside VS Code. We can just click where it says “minikube” at the bottom of the window, then tell minikube to start, and after a few seconds we can see minikube pop up in our Kubernetes Explorer.
Now let’s start building our app. We don’t need to worry about creating all those config files from scratch anymore - click on Cloud Code at the bottom, then pick “New application”, click “Kubernetes application”, and we get a whole list of sample starter apps to choose from. We’re going to use the Python Flask Hello World app. Give our app a name and a location to save it, and we can see all the project files ready for us now in VS Code.
Click on Cloud Code again, and let’s click on “Run on Kubernetes” this time. We’ll get a message to confirm that we are deploying to minikube, and then we can see our app deploying. After it’s done, we’ll get a localhost address to check out our app, and there it is, you can see our demo running from the minikube cluster in VS Code with the help of Google Cloud Code. If we go back to VS code now and make a change, we can see Skaffold at work behind the scenes immediately updating our minikube cluster, and if we go back to our browser now, we can see our changes almost instantly.
Our new “Hello world!“ app looks good in our minikube development environment, so let’s test it in a staging environment now. We can just click to add a new cluster right from the Google Kubernetes Engine Explorer here, and we’ll be given some quick and easy options to deploy a new cluster. This works great for staging, but there are many other possible settings that we’re missing out on when we create a cluster this way, so we’d be better off building a custom config file for deployment to production environments instead.
It can take a few minutes to initialize, but then we should see our new cluster appear in the GKE Explorer. We can also see that our new GKE cluster has switched to the current context for us, so if we try “Run on Kubernetes” again, we’ll find our app now deployed to our GKE cluster instead of locally using minikube. We can check the Services in the Kubernetes Explorer to find the External IP for our cluster, and see our app is online and running. If we make a quick change to our python file, we can see our build immediately updated and deployed to GKE exactly the same way it worked locally with minikube.
VS Code with Google Cloud Code makes short work of kubernetes development, and integrates deployment to both staging and production directly into our IDE so we can stay focused on coding. In the next video, let’s look at how we do the same thing in VS Code for a Cloud Run service instead of a GKE application.
Arthur spent seven years managing the IT infrastructure for a large entertainment complex in Arizona where he oversaw all network and server equipment and updated many on-premise systems to cloud-based solutions with Google Cloud Platform. Arthur is also a PHP and Python developer who specializes in database and API integrations. He has written several WordPress plugins, created an SDK for the Infusionsoft API, and built a custom digital signage management system powered by Raspberry Pis. Most recently, Arthur has been building Discord bots and attempting to teach a Python AI program how to compose music.