# Kubernetes

## Prerequisites

Use the Kubernetes command-line tool, [kubectl](https://kubernetes.io/docs/user-guide/kubectl/), to deploy and manage applications on Kubernetes. Using kubectl, you can inspect cluster resources; create, delete, and update components; look at your new cluster; and bring up apps.

{% embed url="<https://kubernetes.io/docs/tasks/tools/install-kubectl/>" %}

For development and practice you can use a Minikube cluster, but it only intended for testing without pay for a cluster in a provider.&#x20;

## Useful commands

### Deployments and status

Start deployment:

```bash
kubectl apply -f nginx-deployment.yaml
```

Check the status of a deployment:

```bash
kubectl rollout status deployments nginx-deployment
```

```bash
kubectl get deployments
```

```bash
kubectl describe deployments nginx-deployment
```

```bash
kubectl rollout history
```

Then check the status of pod:

```bash
kubectl get pods
```

```bash
kubectl describe pods nginx
```

### Clean up cluster

You might need to clean up it when you work with it.

Delete all pods:

```bash
kubectl delete pods --all
```

Delete all services:

```bash
kubectl delete services --all
```

Delete all deployments:

```bash
kubectl delete deployments --all
```

Delete all replicasets:

```bash
kubectl delete replicasets --all
```

Delete all:

```bash
kubectl delete daemonsets,replicasets,services,deployments,pods,rc --all
```


---

# 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://daton.gitbook.io/daton-mac/kubernetes-1.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.
