> For the complete documentation index, see [llms.txt](https://repo.4pfsec.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://repo.4pfsec.com/google-cloud-computing/cloud-computing-fundamentals/kubernetes-engine-qwik-start.md).

# Kubernetes Engine: Qwik Start

LAB 5

## Overview

[Google Kubernetes Engine](https://cloud.google.com/kubernetes-engine/) (GKE) provides a managed environment for deploying, managing, and scaling your containerized applications using Google infrastructure. The Kubernetes Engine environment consists of multiple machines (specifically [Compute Engine](https://cloud.google.com/compute) instances) grouped to form a [container cluster](https://cloud.google.com/kubernetes-engine/docs/concepts/cluster-architecture). In this lab, you get hands-on practice with container creation and application deployment with GKE.

## Lab

### Set a default compute zone <a href="#step4" id="step4"></a>

Select [your zone](https://cloud.google.com/compute/docs/regions-zones/#available) wisely! Enter the following command to set your zone!

```
gcloud config set compute/zone asia-southeast1-a
```

![](https://561482365-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MdOcy1ba9EGn2GQ7ELK%2Fuploads%2F4gYxW65nXVxIpWzz4FkE%2Fimage.png?alt=media\&token=fb7f3d50-a5fd-4783-acb5-1b52a6e90477)

### Creating a GKE Cluster

A [cluster](https://cloud.google.com/kubernetes-engine/docs/concepts/cluster-architecture) consists of at least one **cluster master** machine and multiple worker machines called **nodes**. Nodes are [Compute Engine virtual machine (VM) instances](https://cloud.google.com/compute/docs/instances/) that run the Kubernetes processes necessary to make them part of the cluster.

Enter the following command to create a cluster.

```
gcloud container clusters create neeishere
```

![](https://561482365-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MdOcy1ba9EGn2GQ7ELK%2Fuploads%2FnaIeCPj9dCVWN5Xn1nRb%2Fimage.png?alt=media\&token=4ffee5a5-ee8b-4a57-b76b-a4846b18a2ee)

### Get authentication credentials for the cluster <a href="#step6" id="step6"></a>

```
gcloud container clusters get-credentials [CLUSTER-NAME]
```

![](https://561482365-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MdOcy1ba9EGn2GQ7ELK%2Fuploads%2FgfMNeZr1qyhjKALmlxOh%2Fimage.png?alt=media\&token=10fa13bf-0770-43a7-8fae-d7e3d2d2ad74)

### Deploy an application to the cluster <a href="#step7" id="step7"></a>

Deploying a test application as shown below.

```
kubectl create deployment hello-server --image=gcr.io/google-samples/hello-app:1.0
```

Creating a Kubernetes Service which lets us expose our application to external traffic:

```
kubectl expose deployment hello-server --type=LoadBalancer --port 8080
```

* `--port` specifies the port that the container exposes.
* `type="LoadBalancer"` creates a Compute Engine load balancer for your container.

![](https://561482365-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MdOcy1ba9EGn2GQ7ELK%2Fuploads%2FAgx7f8urkO5ZMBn66hkl%2Fimage.png?alt=media\&token=5a159cce-bc19-4bee-bc50-4c8a02c82f20)

Inspect Service as shown below to get the public IP:

```
kubectl get service
```

![](https://561482365-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MdOcy1ba9EGn2GQ7ELK%2Fuploads%2FR8J7snhv7JX2E2BB7s66%2Fimage.png?alt=media\&token=75cad5e6-bead-45e9-854b-3032f08fe8d4)

![](https://561482365-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MdOcy1ba9EGn2GQ7ELK%2Fuploads%2F49MrsJ3F89V2oEhAnt4z%2Fimage.png?alt=media\&token=ca900c85-2dc4-4967-bc9d-810b3ffccf4b)

### Deleting the cluster <a href="#step8" id="step8"></a>

```
gcloud container clusters delete neeishere
```

![](https://561482365-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MdOcy1ba9EGn2GQ7ELK%2Fuploads%2FtNzrCz9QoN8lKvnfPmqd%2Fimage.png?alt=media\&token=5f261c5e-9830-4a87-bed7-0762be8c771a)
