How To Run Kubernetes On The Google Cloud Platform

3670 0

Kubernetes is a popular, open-source system for managing and deploying applications on a cluster of Linux-based servers. It is a great way to run your applications in production and has been around since 2013. Google recently announced that it would be moving Kubernetes to its GCP platform—but what does it mean? What can you do with it? And how do you get started?

How To Run Kubernetes On The Google Cloud Platform

If you’re unsure where to start, we are here to help!

Fret not if you want to run Kubernetes on the Google Cloud Platform. We understand that the learning curve for Kubernetes—and the multiple cloud hosting providers—can be challenging for engineers. 

Here’s how to get started!

Kubernetes On The Google Cloud Platform: A Brief Summary

Google Cloud Platform offers a full-featured, enterprise-ready container platform designed from the ground up for Kubernetes. Kubernetes is an open-source project created by Google and the Linux Foundation to manage containerized applications. It’s currently the most popular cloud-native application management framework.

Cloud Platform supports various operating systems, including Linux, Windows, Mac OS X, and FreeBSD. You can run your Kubernetes cluster on top of this technology or use GCP to host your application within one of their managed instances.

The Google Cloud Platform documentation and a few training programs, like “Architecting with Google Kubernetes Engine Training,” thoroughly explain the platform and how to get started. 

Here are some tips for setting up Kubernetes on GCP:

  • Select the right region
  • Create a cluster
  • Set up your application components
  • Configure DNS and load balancers

Steps To Set Up Kubernetes On The Gcp

Step 1: Sign Up For A Google Account—This Is Free

Google offers a free platform trial lasting 12 months. That’s not it. It also includes €300 in credits. This gives lots of space for setting up easy clusters and deploying applications. So, if you don’t already have one, head to https://accounts.google.com/signup and follow the instructions there.

However, you won’t be able to deploy anything too complicated during the free trial due to resource restrictions.

Step 2: Create the cluster
  1. After registering on GCP, you’ll receive a Project. All of your GCP resources are created here.
  2. Next, select Kubernetes Engine from the console menu in the top left. Then click Clusters.
  3. Click the Create cluster button to continue.
  4. Now, you will see a lengthy list of cluster settings and templates from which to select. Keep the Standard cluster checkbox chosen and give the cluster a new name in the Name field.
  5. You can only construct a Zonal cluster during the free trial. Pick a Zone that is near where you are. The Master version specifies the Kubernetes version that your cluster will utilize. Which version of Kubernetes your cluster will use is determined by the Master version. You can keep it to the default choice and choose from various possibilities.
  6. To accept deployments from outside sources, you must select at least 1.14 if you wish to follow the configuration instructions in the next section.
  7. You can set up the cluster’s default node pool in the next section. This is the set of systems that GCP uses exclusively to run your cluster and its resources. If you wish to complete the setups in the following step, you can leave this section alone, but you should change the number of nodes to 6.
  8. Then, Click Create now.
  9. Your cluster’s initialization via GCP will take some time (usually at least five minutes). GCP will notify you via the user interface when your cluster is prepared.
  10. Don’t forget to delete your cluster if you decide to no longer require it before using up all your free credits later.
Step 3. Enable connections & deployments from outside

You have now completed the complete setup of your cluster. Code can be deployed to your cluster in a variety of ways.

  1. Go to the Deployments section and start a deployment there, or you could manually upload your pictures to GCP. You must set up your cluster to permit connections from the outside if you’re working with a team on a project with a complete CI/CD pipeline connected to your code repository, Docker registry, and CI tool.
  2. Next, Enable APIs.
  3. The Kubernetes Engine API, the Cloud Resource Manager API, and the Stackdriver API must first be enabled for your Project. These APIs give your pipeline a programmatic interface that can add to and modify the resources in your cluster.
  4. Highlight APIs & Services, then select Dashboard from the console menu in the top left.
  5. In the search box at the top of the page, type the name of the API you wish to activate. Click on the API when it displays. The API overview page will then be displayed.
  6. Then click Enable API.
  7. Next, set up a service account.
  8. Your tools can access the service account to add and modify resources in your cluster.
  9. Select IAM & admin from the console menu in the top left, then click Service accounts.
  10. At the top of the page, click Create service account.
  11. Click Create after providing a name for your service account.
  12. The next step is to specify the service account’s permissions. Kubernetes Engine Admin should appear in the option field; select it by clicking the role when it does.
  13. Then click Next.
  14. You’re almost done, but you still need to give the account an access key. This key must authenticate with the platform by whichever tool you use to deploy to your cluster.
  15. When prompted, save the file by selecting JSON and pressing Create key. Keep this file safe; GCP will only provide you with this copy.                   

What are the Next Steps?

Deploying containerized web applications is one of the most common use cases for the Google Cloud Platform. These applications are made up of Docker images downloaded from a registry and installed as containers inside your cluster. Developers use kubectl and the Google Cloud SDK for GCP to deploy to and manage clusters.

Conclusion

Kubernetes is a widespread infrastructure for containerized applications, but it’s not the only option. Google Cloud Platform (GCP) also offers Kubernetes, making it easier to run containers on GCP. We hope this blog helped you understand how to get started with a basic Kubernetes cluster using the GCP user interface.

To learn more about deploying and managing containerized applications on Google Kubernetes Engine (GKE), take this 3-day training from Spring People!

 

About Pradeep Kumar

Pradeep Kumar

Pradeep comes with more than 18 years of extensive experience in building fault tolerant, highly scalable cloud native applications. He strives on writing clean code, emphasis on domain driven design principles and conduct workshops on building production grade web applications covering all the challenging concerns.


Posts by Pradeep Kumar

Leave a Reply

Your email address will not be published. Required fields are marked *

CAPTCHA

*