Launch an Application using Kubernetes on Google Cloud.

Launch an Application using Kubernetes on Google Cloud.

What is cloud computing?

Cloud computing is the on-demand availability of computer system resources, especially data storage and computing power, without direct active management by the user. The term is generally used to describe data centers available to many users over the Internet.

There are two types cloud:- 1. Public Cloud 2. Private Cloud

1. Public Cloud:-

A public cloud is a type of computing in which a service provider makes resources available to the public via the internet. Public cloud allows for scalability and resource sharing that would not otherwise be possible for a single organization to achieve. For example:- AWS, GCP, Azure, etc.

2. Private Cloud:-

Private cloud is a computing model that offers a proprietary environment dedicated to a single business entity. As with other types of cloud computing environments, private cloud provides extended, virtualized computing resources via physical components stored on-premises or at a vendor's datacenter. For example:- Openstack, etc.

Now, we will launch an application using Kubernetes on Google Cloud.

So let's get started...

Step1:- First, we have to Click on My First Project on GCP.

No alt text provided for this image

Step 2:- Click on NEW PROJECT to create a new project on GCP Cloud.

No alt text provided for this image

Step 3:- Write Project name and if you want then you can edit Project ID as well by clicking on EDIT option, then click on CREATE button.

No alt text provided for this image

Step 4:- Similarly, create one more project for production and  enable Compute Engine API on both projects.

No alt text provided for this image

Step 5:- Next, we have to create a VPC in both the projects. The steps for the same are as follows:


  • Click on CREATE VPC NETWORK
No alt text provided for this image
  • Fill the Name of VPC, Name of New Subnet and IP address range and also select the Region according to your choice.
No alt text provided for this image
  • Similarly, create one more VPC in production project.
No alt text provided for this image

Step 6:- Now, we have to link both the VPC using VPC Peering. The steps for the same are as follows:

  • Click on CREATE PEERING CONNECTION
No alt text provided for this image
  • Click on CONTINUE button.
No alt text provided for this image
  • Fill the Name of Peering Connection, select the Network from which you want to peer this VPC and then, select the VPC Network which you want to peer is in the current project or in other and also fill the Project ID as well as give the VPC Network Name and click on CREATE button.
No alt text provided for this image
  • Similarly, we have to create the peering connection from the production project as well otherwise it will remain inactive.
No alt text provided for this image
No alt text provided for this image

Step 7:-  Now, we have to create a Kubernetes Cluster in developer project. The step for the same are as follows:-

  • Click on Create Cluster button.
No alt text provided for this image
  • Fill the Name of Cluster, choose Location type and Master Version and click on CREATE button.
No alt text provided for this image
  • Now, fill the details for NODE POOLS i.e., Name of the Pool, select Node version and size and specify node locations then, click on CREATE button.
No alt text provided for this image
  •  Next, select the Image type, Series, Machine type, Boot disk type and size and also choose Machine family and then, click on CREATE button.
No alt text provided for this image
  • Now fill the Networking part, select Network, Node subnet, enable the traffic and also set the limit of pods per node and click on CREATE button.
No alt text provided for this image


Our Kubernetes Cluster is ready...

No alt text provided for this image


Step 8:- Next, we have to install SDK for Google Cloud.


Step 9:- Now, we have to install kubectl and configure it. You can go through the following link for the same:-

Step 10:- Now, we will deploy an OS with the desired image, H ere, I am using the image whih has WordPress already configured in it. You can configure it by your own. The command for deployment is as follows:-

kubectl.exe create deployment myweb --image = vimal13/apache-webserver-php
  • Next, scale it with the following command:-
kubectl.exe scale deployment myweb --replicas=5



  • Now, expose it with the following command:-
kubectl.exe expose deployment myweb --type=LoadBalancer --port=80

Load Balancer is created successfully...

No alt text provided for this image

Step 11:- Now, we have to create a SQL server in the production project and also have to create a database. The steps for the same are as follows:-

  • Click on CREATE INSTANCE
No alt text provided for this image
  • Now, choose the database engine. Here, I am choosing MySQL, you can choose according to your requirement.
No alt text provided for this image
  • Now, fill the details like Instance ID, set Root Password, and also choose Region and Database version.
No alt text provided for this image
  • If you want to edit anything, then you can edit.
No alt text provided for this image
  • Now, create the database by filling Database Name and clicking on CREATE button as shown below.
No alt text provided for this image

Step 12:-  Now, we have to connect the database to the web application launched in the Kubernetes Cluster. Run the following command:-

kubectl.exe get services


Finally, our application on WordPress is launched...

No alt text provided for this image


Thanks for reading :)



要查看或添加评论,请登录

Nimish Agarwal的更多文章

社区洞察

其他会员也浏览了