# See what runs in a cluster

See a cluster's workloads, pods, Services, Ingresses, configuration and events, and which hosts it serves to the internet, without kubectl and also for a cluster whose endpoint is private.

Replace _my-cluster_ with your cluster's name or id. The view is read by the cluster's own control
plane, so it also works when the cluster's endpoint is private.

| Section            | What it shows                                                                                                                                                 |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Workloads          | Deployments, StatefulSets, DaemonSets, Jobs and CronJobs: status, ready of desired, restarts of their pods, image, age                                        |
| Pods               | Status (with the reason a container is not running, such as `CrashLoopBackOff`), ready containers, restarts, node, workload, last event                       |
| Services & Ingress | What is reachable from the internet; every host an Ingress names with its DNS, HTTPS and certificate check; Services, Ingresses and cert-manager certificates |
| Config             | ConfigMaps with their key names; Secrets with their type and number of keys                                                                                   |
| Events             | Kubernetes events of the last hour or so, warnings first                                                                                                      |

## Prerequisites

- Permission for `eks:DescribeClusterResources` on the cluster.
- An [access entry](give-access.md) on the cluster. You see what your own Kubernetes identity may
  list, as with kubectl: an entry with **View** in one namespace shows that namespace only, and no
  Secrets. Roles and bindings you wrote yourself for the entry's extra groups count too.

## Open the view

**Console**
1. Open **Kubernetes**, open the cluster, then choose **Resources**.
2. Choose **Workloads**, **Pods**, **Services & Ingress**, **Config** or **Events**.
3. (Optional) Choose a namespace. **All namespaces** leaves out `kube-system`, `kube-public`,
   `kube-node-lease` and `ews-system`; **All namespaces, system ones too** includes them.

Choose a row to see it in full. **Refresh** reads the view again; the time beside it says when the
cluster reported it.

**CLI**
```sh
dcloud eks clusters resources my-cluster --namespace shop
```

**API**
```http
GET /eks/api/clusters/my-cluster/resources?namespace=shop
```

**Terraform:** not available. Reading what runs in a cluster is not a resource.

The answer is `{ "ready": false }` until the cluster has reported once, which it does within a
minute of the first request. After that, `collectedAt` says when the cluster read it.

## What is reachable from the internet

The cluster's **Overview** and the top of **Services & Ingress** list:

- **Load balancers**: each Service of type `LoadBalancer`, and each Service that claims
  `externalIPs`, with its public addresses and ports. A `NodePort` Service answers on the nodes
  only when the nodes' security group lets its port in, which it does not by default.
- **Hosts**: every host an Ingress names in its rules or TLS section. For each one,
  Deutsche Cloud looks the host up in public DNS. When every address points at one of this cluster's
  load balancers, it requests `https://<host>/` and records the status and the certificate served
  (issuer, expiry, whether it is trusted and names the host).

| State                 | Meaning                                                                                          |
| --------------------- | ------------------------------------------------------------------------------------------------ |
| Answers               | HTTPS answers with a trusted certificate for the host                                            |
| No DNS record         | Public DNS has no A or AAAA record for the host                                                  |
| DNS points elsewhere  | The host resolves to addresses that are not this cluster's load balancers; nothing was requested |
| HTTPS fails           | No answer on port 443 (connection refused, timeout)                                              |
| Certificate problem   | The certificate served is not trusted, names another host, or ends within 14 days                |
| Answers with an error | HTTPS answers 404 or a 5xx on `/`                                                                |

Hosts are checked every 5 minutes while someone looks at the cluster, and every 30 minutes
otherwise. A wildcard host is not checked; a host that resolves to an address that is not public
is not requested.

## Fix a host that does not answer

- **No DNS record** or **DNS points elsewhere**: create an A record for the host that points at the
  load balancer's address, or install the `external-dns` add-on for the zone.
- **Certificate problem** with the ingress controller's default certificate: add a `tls` section
  for the host to the Ingress, with a Secret that holds its certificate, or let cert-manager issue
  one (annotation `cert-manager.io/cluster-issuer: letsencrypt`). The host's row names the
  cert-manager Certificate and why it is not ready.
- **Answers with an error** `404`: nothing serves the root path for this host. Check the Ingress's
  paths and its ingress class.

## What is read and what is not

- The cluster's control plane reads the view every 20 seconds while someone looks at it, and every
  5 minutes otherwise.
- Secret values and ConfigMap values never leave the cluster. Secrets are read as names, type and
  number of keys; ConfigMaps as names and key names.
- Rules that apply only to named objects (`resourceNames`) do not grant listing, so they do not
  widen the view.
- A large cluster is cut at 5,000 pods, 3,000 workloads and 1,000 events; the view then says which
  kinds were cut.

## Related

- [Give someone access](give-access.md)
- [Expose a Service](expose-a-service.md)
- `eks.clusters.resources` · `dcloud eks clusters resources`
