Getting Started with Containers in Google Cloud Platform: Deploy, Manage, and Secure Containerized Applications
By Shimon Ifrah
()
About this ebook
You will start by setting up and configuring GCP tools and the tenant environment. You then will store and manage Docker container images with GCP Container Registry (ACR). Next, you will deploy containerized applications with GCP Cloud Run and create an automated CI/CD deployment pipeline using Cloud Build. The book covers GCP’s flagship service, Google Kubernetes Service (GKE), and deployment of a Kubernetes cluster using clear steps and considering GCP best practices using the GCP management console and gcloud command-line tool. Also covered is monitoring containers and containerized applications on GCP with Cloud Monitoring, and backup and restore containers and containerized applications on GCP.
By the endof the book, you will know how to get started with GCP container services and understand the fundamentals of each service and the supporting services needed to run containers in a production environment. This book also assists you in transferring your skills from AWS and Azure to GCP using the knowledge you have acquired on each platform and leveraging it to gain more skills.
What You Will Learn
- Get started with Google Cloud Platform (GCP)
- Store Docker images on GCP Container Registry
- Deploy Google Kubernetes Engine (GKE) cluster
- Secure containerized applications on GCP
- Use Cloud Build to deploy containers
- Use GCP Batch for batch job processing on Kubernetes
Who This Book Is For
Google Cloud administrators, developers, and architects who want to get started and learn more about containers and containerized applications on Google Cloud Platform (GPC)
Read more from Shimon Ifrah
Deploy Containers on AWS: With EC2, ECS, and EKS Rating: 0 out of 5 stars0 ratingsGetting Started with Containers in Azure: Deploy, Manage, and Secure Containerized Applications Rating: 0 out of 5 stars0 ratings
Related to Getting Started with Containers in Google Cloud Platform
Related ebooks
Beginning Kubernetes on the Google Cloud Platform: A Guide to Automating Application Deployment, Scaling, and Management Rating: 0 out of 5 stars0 ratingsPro DevOps with Google Cloud Platform: With Docker, Jenkins, and Kubernetes Rating: 0 out of 5 stars0 ratingsA Developer's Essential Guide to Docker Compose: Simplify the development and orchestration of multi-container applications Rating: 0 out of 5 stars0 ratingsManaging Microsoft Hybrid Clouds Rating: 0 out of 5 stars0 ratingsAzure Bicep QuickStart Pro Rating: 0 out of 5 stars0 ratingsHands-on GitHub Actions: Implement CI/CD with GitHub Action Workflows for Your Applications Rating: 0 out of 5 stars0 ratingsCloud Cost A Complete Guide - 2020 Edition Rating: 0 out of 5 stars0 ratingsCloud Computing For Beginners: Your First Step into the Future of Tech Rating: 0 out of 5 stars0 ratingsAugmenting Customer Experience with SharePoint Online: Building Portals and Practices to Improve Usability Rating: 0 out of 5 stars0 ratingsArchitecting CSS: The Programmer’s Guide to Effective Style Sheets Rating: 0 out of 5 stars0 ratingsDevOps for Azure Applications: Deploy Web Applications on Azure Rating: 0 out of 5 stars0 ratingsArtificial Intelligence for Fashion: How AI is Revolutionizing the Fashion Industry Rating: 0 out of 5 stars0 ratingsData Teams: A Unified Management Model for Successful Data-Focused Teams Rating: 0 out of 5 stars0 ratingsHands-on Azure Boards: Configuring and Customizing Process Workflows in Azure DevOps Services Rating: 0 out of 5 stars0 ratingsMongoDB Recipes: With Data Modeling and Query Building Strategies Rating: 0 out of 5 stars0 ratingsBuilding Microservices Applications on Microsoft Azure: Designing, Developing, Deploying, and Monitoring Rating: 0 out of 5 stars0 ratingsWeb API Complete Self-Assessment Guide Rating: 0 out of 5 stars0 ratingsAssessing IT Projects to Ensure Successful Outcomes Rating: 0 out of 5 stars0 ratingsCyber Security on Azure: An IT Professional’s Guide to Microsoft Azure Security Rating: 0 out of 5 stars0 ratingsCode Leader: Using People, Tools, and Processes to Build Successful Software Rating: 5 out of 5 stars5/5Understanding Azure Monitoring: Includes IaaS and PaaS Scenarios Rating: 0 out of 5 stars0 ratingsData Lake A Complete Guide - 2019 Edition Rating: 0 out of 5 stars0 ratingsGCP A Complete Guide - 2021 Edition Rating: 0 out of 5 stars0 ratingsPro SQL Server 2019 Administration: A Guide for the Modern DBA Rating: 0 out of 5 stars0 ratingsCloud Migration A Complete Guide - 2019 Edition Rating: 0 out of 5 stars0 ratingsUnderstanding Microsoft Teams Administration: Configure, Customize, and Manage the Teams Experience Rating: 0 out of 5 stars0 ratingsHello Code : Book for Programmer Not Computer Rating: 0 out of 5 stars0 ratingsDomain Controller A Complete Guide - 2021 Edition Rating: 0 out of 5 stars0 ratings
Computers For You
Elon Musk Rating: 4 out of 5 stars4/5The Invisible Rainbow: A History of Electricity and Life Rating: 5 out of 5 stars5/5How to Create Cpn Numbers the Right way: A Step by Step Guide to Creating cpn Numbers Legally Rating: 4 out of 5 stars4/5Uncanny Valley: A Memoir Rating: 4 out of 5 stars4/5Standard Deviations: Flawed Assumptions, Tortured Data, and Other Ways to Lie with Statistics Rating: 4 out of 5 stars4/5Alan Turing: The Enigma: The Book That Inspired the Film The Imitation Game - Updated Edition Rating: 4 out of 5 stars4/5Mastering ChatGPT: 21 Prompts Templates for Effortless Writing Rating: 4 out of 5 stars4/5The ChatGPT Millionaire Handbook: Make Money Online With the Power of AI Technology Rating: 4 out of 5 stars4/5Procreate for Beginners: Introduction to Procreate for Drawing and Illustrating on the iPad Rating: 5 out of 5 stars5/5SQL QuickStart Guide: The Simplified Beginner's Guide to Managing, Analyzing, and Manipulating Data With SQL Rating: 4 out of 5 stars4/5Deep Search: How to Explore the Internet More Effectively Rating: 5 out of 5 stars5/5The Innovators: How a Group of Hackers, Geniuses, and Geeks Created the Digital Revolution Rating: 4 out of 5 stars4/5An Ultimate Guide to Kali Linux for Beginners Rating: 3 out of 5 stars3/5The Hacker Crackdown: Law and Disorder on the Electronic Frontier Rating: 4 out of 5 stars4/5Slenderman: Online Obsession, Mental Illness, and the Violent Crime of Two Midwestern Girls Rating: 4 out of 5 stars4/5101 Awesome Builds: Minecraft® Secrets from the World's Greatest Crafters Rating: 4 out of 5 stars4/5Grokking Algorithms: An illustrated guide for programmers and other curious people Rating: 4 out of 5 stars4/5Creating Online Courses with ChatGPT | A Step-by-Step Guide with Prompt Templates Rating: 4 out of 5 stars4/5Everybody Lies: Big Data, New Data, and What the Internet Can Tell Us About Who We Really Are Rating: 4 out of 5 stars4/5Learning the Chess Openings Rating: 5 out of 5 stars5/5Tor and the Dark Art of Anonymity Rating: 5 out of 5 stars5/5Dawn of the New Everything: Encounters with Reality and Virtual Reality Rating: 4 out of 5 stars4/5
Reviews for Getting Started with Containers in Google Cloud Platform
0 ratings0 reviews
Book preview
Getting Started with Containers in Google Cloud Platform - Shimon Ifrah
© Shimon Ifrah 2021
S. IfrahGetting Started with Containers in Google Cloud Platform https://doi.org/10.1007/978-1-4842-6470-6_1
1. Get Started with Google Cloud Platform (GCP)
Shimon Ifrah¹
(1)
Melbourne, VIC, Australia
In this chapter, we will get started with Google Cloud Platform (GCP) by covering the following topics:
Get introduction to GCP
Learn the benefits of a GCP free tier account
Understand projects in GCP
Use Cloud Shell to deploy workloads
Secure the GCP account
Learn about GCP container services
Introduction
Google Cloud Platform (GCP) was launched in November 2011 as a public cloud computing platform offering computing, storage, networking, database, Big Data, security, and identity services. The seed that grew into GCP was the 2008 release of the Google App Engine, which offered runtime and platform as a service (PaaS) web services to developers inside Google data centers. GCP is also part of the Google Cloud, which includes the business productivity suite, also known as G Suite. As of writing this book, GCP has a presence in twenty countries across sixty-one datacenters.
Currently, GCP offers around ninety products and cloud services in the following categories:
Compute Services: App Engine, Compute Engine (virtual machines), Kubernetes, Cloud Functions, Cloud Run
Storage and Databases: Cloud storage, SQL, BigTable, Spanner
Networking: VPC, load balancing, Armor, CDN, Interconnect, cloud DNS
Big Data: Big Query, cloud dataflow, Dataproc, Composer, Datalab, Dataprep, Pub/Sub, Data StudioAutoML
Cloud AI: AutoML, TPU, Machine Learning Engine, Job Discovery, Dialogflow Enterprise, natural language, speech-to-text, text-to-speech, Translation API, Vision API, Cloud Video Intelligence
Management Tools:Stackdriver, Deployment Manager, Cloud Console, Cloud Shell, Console Mobile App, APIs
Identify and Security: IAM, Identity-Aware Proxy, Data Loss Prevention API, Key Enforcement, Key Management Service, Resource Manager, Security Command Center, Security Scanner, Access Transparency, VPC Service Controls
IoT: IoT Core, Edge TPU, IoT Edge
API Platform: Maps Platform, Apigee API Platform, API Monetization, Developer Portal, API Analytics, Apigee Sense, Endpoints
GCP also offers professional certifications for engineers, developers, and architects.
Get Started with Google Cloud Platform (GCP)
We will get started by building the fundamentals needed to deploy services and applications to GCP, which is an integrated cloud platform. Our focus will be on GCP’s container services, but at the same time we will set up all the support services that are needed to run production workloads securely and reliably.
The Benefits of a GCP Free Tier Account
The GCP free tier account comes with a number of free services that you will never be asked to pay for, regardless of whether the twelve-month period has passed. Having access to always-free services can help with the testing of applications, scripts, and many more tasks you might need to test during the lifecycle of your application.
GCP Free Tier
To help engineers, developers, and architects get started with GCP, Google offers a free tier subscription for new users that provides the following:
$300 credit for twelve months
Always-free GCP services that include:
Free monthly use of an f1-micro virtual machine instance
5GB per month of cloud storage
Access to free Cloud Functions (serverless)
No cluster management fee for Google Kubernetes Engine (GKE) cluster (you will pay for nodes only)
Access to run free web applications on App Engine
60 minutes of free speech-to-text service
120 minutes of Cloud Build service
Sign Up for GCP Free Tier account
To sign up for a free tier account and use the $300 free credit, perform the following steps:
Go to the following URL: https://cloud.google.com/free
Click on the Get Started for Free button to start the registration process, as shown in Figure 1-1.
../images/496339_1_En_1_Chapter/496339_1_En_1_Fig1_HTML.jpgFigure 1-1
Get started with GCP
Follow the registration and verification process, and you will see the free credit notice, as shown in Figure 1-2. You will also need to provide a credit card during the process; however, it will not be charged until you activate billing on your account.
../images/496339_1_En_1_Chapter/496339_1_En_1_Fig2_HTML.jpgFigure 1-2
$300 credit for free
On completion, you will see the Google Cloud console, as shown in Figure 1-3. The left navigation menu offers access to all the services available on the GCP platform. The Dashboard offers access to the actual selected service. You can access the GC console directly using the following link: https://console.cloud.google.com/
../images/496339_1_En_1_Chapter/496339_1_En_1_Fig3_HTML.jpgFigure 1-3
Google Cloud console
To check the status of your GCP billing and how much free credit is left, do the following:
From the GC Console’s Navigation menu, click on Billing.
The Billing dashboard will display the current free credit left on the account, as shown in Figure 1-4. For instance, I have $447 AUD, which is equivalent to $300 USD.
../images/496339_1_En_1_Chapter/496339_1_En_1_Fig4_HTML.jpgFigure 1-4
Promotional credits
Understanding GCP Projects
Before we go deeper into the GCP platform, I would like to explain an essential and fundamental concept that you should know. Everything in GCP is based on a project; a project is a logical unit that organizes resources like storage, compute, API, permissions, and billing. Each project is a separate entity, which means that resources in one project cannot access resources from other projects. Once a project is deleted, all resources inside the project except users are removed, which makes it cost-effective and efficient.
A common reason for using projects in GCP is to separate production and development workloads into different projects. By doing so, we prevent the breakdown of our production environment as a result of mixing it with non-production workloads.
Creating a Project
To understand the concept a bit better, let’s go ahead and create a project that will host a Linux instance. GCP will create a default project and make things a bit easier for you to get started. The default project is called My First Project, as shown in Figure 1-5.
../images/496339_1_En_1_Chapter/496339_1_En_1_Fig5_HTML.jpgFigure 1-5
My First Project
In our case, I will create a new project and place my virtual machine instance in it. To do so, I will use the GCP Resource Manager console; to access the console, click on IAM & Admin from the Navigation menu and select Manage resources,
as shown in Figure 1-6.
Figure 1-6
Manage resources
Note
You can also access the Resource Manager console from the top search box by searching for manage resources.
To create a new project, click on the Create Project button on the top menu, as shown in Figure 1-7.
../images/496339_1_En_1_Chapter/496339_1_En_1_Fig7_HTML.jpgFigure 1-7
Create a new project
Note
You can also delete an existing project from the same console.
On the New Project page, fill in the project name details and click Create, as shown in Figure 1-8.
../images/496339_1_En_1_Chapter/496339_1_En_1_Fig8_HTML.jpgFigure 1-8
Create a new project
Note
By default, each GCP tenant can create twenty-five projects; if you need to create more than twenty-five projects, you will need to contact support and request a quota increase. The process to request a quota increase is straightforward and involves filling in a form and waiting for GCP to increase the quota. This process helps GCP manage their resource allocation strategy and ensure the platform is not over-utilized.
It will take GCP thirty seconds to create the project, at which point it becomes available to us. After the project is ready, we can access it from the projects drop-down list located at the top-left corner, as shown in Figure 1-9. To open my new project, I will click on the arrow and select my project from the Select a Project page.
../images/496339_1_En_1_Chapter/496339_1_En_1_Fig9_HTML.jpgFigure 1-9
Select a Project page
Create a VM Instance
To create a new virtual machine instance, use the Navigation menu , click on Compute Engine, and select VM Instances
from the list. The first time you access VM Instances, you will see a message telling you that Compute Engine is getting ready . . . ,
which means GCP is preparing the backend infrastructure needed to provision VMs. While the GCP prepares the infrastructure, the Create button is grey, and you cannot create instances. When the process is completed, go ahead and click Create. The getting ready message is shown in Figure 1-10.
Figure 1-10
VM Instances
After clicking on Create, you will see the Create an Instance page with all the options. The GCP VM creation process is very straightforward and is available in a single-page wizard, which makes the process simpler and faster.
To create an instance, fill in the Name, Region, Zone, Image, and Instance Size fields. The Create an Instance page is shown in Figure 1-11.
../images/496339_1_En_1_Chapter/496339_1_En_1_Fig11_HTML.jpgFigure 1-11
Create an instance
GCP made the costing of the VM very clear; the monthly cost of the instance will show up on the left. In my case, the VM will cost me $4.28 a month, which comes out to $0.006 per hour. GCP also displays the estimated cost breakdown, which includes compute and disk. Figure 1-12 shows the cost estimate for my VM instance.
../images/496339_1_En_1_Chapter/496339_1_En_1_Fig12_HTML.jpgFigure 1-12
VM instance cost estimates
Use REST API Request to Create VM Instance
If you scroll down to the bottom of the Create VM Instance page, you will see an option to create the same instance and configuration using the REST API. The REST API allows you to create, manage, and delete resources in GCP using programming languages like Python, .NET, and Node.js.
If you click on the REST
link under the Create button, as shown in Figure 1-13, you will see the code you need to use to create the instance.
Figure 1-13
REST API command
In Figure 1-14, you can see the REST API requests required to create the instance. For more information about accessing and using the GCP REST API, please visit the following URL:
../images/496339_1_En_1_Chapter/496339_1_En_1_Fig14_HTML.jpgFigure 1-14
REST API request
https://cloud.google.com/compute/docs/apis?hl=en_GB
Use gcloud Command Line to Create VM Instance
You can also use the gcloud command-line utility to create the same instance. If you click on the Command Line
link shown in Figure 1-13, you will see the gcloud command you need to run to create the VM instance, shown in Figure 1-15.
Figure 1-15
gcloud Command Line
In a later section, we will explore Cloud Shell and gcloud commands.
Once the VM has been created, you can see the VM Instances page, as shown in Figure 1-16.
../images/496339_1_En_1_Chapter/496339_1_En_1_Fig16_HTML.jpgFigure 1-16
VM instances
Delete a Project
Now that we have created our first VM, let’s go ahead and delete a project and see the end-to-end process. To delete a project, from the Navigation menu, do the following:
Click on IAM & Admin
From the extended list, click on Manage Resources. From the Manage Resources page, select Web-project.
Click on the Delete button, as shown in Figure 1-17.
../images/496339_1_En_1_Chapter/496339_1_En_1_Fig17_HTML.jpgFigure 1-17
Delete project
After you click Delete, you will be presented with the shut down project
message that is shown in Figure 1-18. To confirm the deletion of the project, you need to actually type the name of the project, and not just copy and paste the name.
Figure 1-18
Shut down project
Once you type the project name and click Shut Down, GCP will keep all the resources inside the project for thirty days, after which point all resources will be deleted.
After removing the project, you will see the pending deletion
message that is shown in Figure 1-19.
Figure 1-19
"Pending