# Managing Kubernetes

## CLI

* `kubectl` _(Kube control)_ Kubernetes Command Line Interface (CLI) client to manage cluster resources and applications.
* It is very flexible and easy to integrate with other systems, therefore it can be used standalone, or part of scripts and automation tools.
* Once all required credentials and cluster access points have been configured for kubectl, it can be used remotely from anywhere to access a cluster.
* Recommended to be separately installed, kubectl receives its configuration automatically for Minikube Kubernetes cluster access.
  * However, in different Kubernetes cluster setups, we may need to manually configure the cluster access points and certificates required by kubectl to securely access the cluster.

## Dashboard

![Kubernetes Dashboard](https://574639531-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJDnjsv52I3fJ56WbLgHu%2Fuploads%2Fgit-blob-1526a66721db77f7e114e789fdcb384ab47659fb%2FK8_Dashboard.png?alt=media)

* a Web-based User Interface (Web UI) to interact with a Kubernetes cluster to manage resources and containerized applications.
* While not as flexible as the kubectl CLI client tool, it is still a preferred tool to users who are not as proficient with the CLI.

### Minikube & Dashboard

* Minikube installs the Dashboard as an addon, but it is disabled by default.
* Prior to using the Dashboard we are required to enable the Dashboard addon, together with the metrics-server addon, a helper addon designed to collect usage metrics from the Kubernetes cluster.
* To access the dashboard from Minikube, we can use the minikube dashboard command, which opens a new tab in our web browser displaying the Kubernetes Dashboard, but only after we list, enable required addons, and verify their state.

```sh
    minikube addons list

    minikube addons enable metrics-server

    minikube addons enable dashboard

    minikube addons list

    minikube dashboard

    minikube dashboard --url # Request url of dashboard
```

## API Directory Tree

![HTTP API Tree](https://574639531-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJDnjsv52I3fJ56WbLgHu%2Fuploads%2Fgit-blob-11f27be42a3ceed9faa5968d7709111fa5ab856c%2FAPI_Server_Tree.png?alt=media)

* The tree can be divided into three independent group types.
  * Core group `(/api/v1)`
    * This group includes objects such as Pods, Services, Nodes, Namespaces, ConfigMaps, Secrets, etc.
  * Named group
    * This group includes objects in /apis/`$NAME/$VERSION` format. These different API versions imply different levels of stability and support:
    * Alpha level - it may be dropped at any point in time, without notice. For example, /apis/batch/v2alpha1.
    * Beta level - it is well-tested, but the semantics of objects may change in incompatible ways in a subsequent beta or stable release. For example, /apis/certificates.k8s.io/v1beta1.
    * Stable level - appears in released software for many subsequent versions. For example, /apis/networking.k8s.io/v1.
  * System-wide
    * This group consists of system-wide API endpoints, like /healthz, /logs, /metrics, /ui, etc.
* We can access an API Server either directly by calling the respective API endpoints, using the CLI tools, or the Dashboard UI.
