# Kubernetes Engine

When you run a GKE cluster, you also gain the benefit of advanced cluster management features that Google Cloud provides. These include:

* Load balancing for Compute Engine instances
* Node pools to designate subsets of nodes within a cluster for additional flexibility
* Automatic scaling of your cluster's node instance count
* Automatic upgrades for your cluster's node software
* Node auto-repair to maintain node health and availability
* Logging and Monitoring with Cloud Monitoring for visibility into your cluster

A cluster consists of at least one **cluster master** machine and multiple worker machines called **nodes**. Nodes are Compute Engine virtual machine (VM) instances that run the Kubernetes processes necessary to make them part of the cluster.

#### To **create a cluster**

```
gcloud container clusters create [CLUSTER-NAME]
```

**After creating your cluster, you need authentication credentials to interact with it.** \
**To authenticate the cluster**

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

#### To **create a Kubernetes Service**, which is a Kubernetes resource that lets you expose your application to external traffic

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

In this command:

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

#### To **delete** the cluster

```
gcloud container clusters delete [CLUSTER-NAME]
```

#### Commands

```
gcloud container clusters create learning-cluster
```

```
gcloud container clusters get-credentials learning-cluster
```

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

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

```
kubectl get service
```

```
gcloud container clusters delete learning-cluster
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dailyjournal.gitbook.io/cloud-computing/cloud-computing-platforms/google-cloud/compute/kubernetes-engine.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
