---
title: Basic commands
slug: hosty/basic-commands
createdAt: 2026-11-08T11:27:49.710Z
---

Commands that admins use most often to look into a cluster. Run them in the Hosty container (`make cli`), with an MFA session (`hosty auth`) and the VPN of the cluster connected.

Names to know:

| What                           | Name                                                                     |
| ------------------------------ | ------------------------------------------------------------------------ |
| Namespaces of a project        | `<project>-production` and `<project>-development`                       |
| Helm release of an environment | `<project>-<environment>`, for example `shop-production` or `shop-stage` |
| Pods of an application         | `<project>-<environment>-<application>-...`                              |
| Containers in a pod            | `php` with `nginx` or `apache`, `node`, or `python` with `nginx`         |

## Connect to a cluster

```bash
aws eks update-kubeconfig --name <cluster> --region <region>
```

It adds the cluster to your kubectl config and makes it the current one. Hosty CLI does the same for you on the first command for a project. With several clusters, switch between them with:

```bash
kubectl config get-contexts
kubectl config use-context <context>
```

## Environments

List all environments of all projects:

```bash
helm ls -A
```

List the environments of a project, including the ones that failed or got stuck:

```bash
helm ls --all -n <project>-development
```

See the last deployments of an environment and the version of Hosty that made them:

```bash
helm history -n <project>-production <project>-production
```

Delete a development environment, the same as `hosty delete <environment>`:

```bash
helm uninstall -n <project>-development <project>-<environment>
```

Only admins can delete production, which makes a final backup and then drops its database. See [Deleting a project](https://wiki.systemseed.com/hosty/deleting-a-project).

## Pods

List the namespaces, and the pods of a namespace:

```bash
kubectl get namespaces
kubectl get pods -n <namespace>
```

List the pods of one environment:

```bash
kubectl get pods -n <namespace> -l app.kubernetes.io/part-of=<project>-<environment>
```

Show recent events of a namespace, such as failed scheduling, failed image pulls or failed health checks:

```bash
kubectl get events -n <namespace> --sort-by=.lastTimestamp
```

List the jobs and cron jobs of a namespace (imports, backups, cleanups, `hosty run`, cron):

```bash
kubectl get jobs,cronjobs -n <namespace>
```

Open a shell in a container:

```bash
kubectl exec -it -n <namespace> <pod> -c <container> -- sh
```

## Logs

Logs of all containers in a pod, or of one container:

```bash
kubectl logs -n <namespace> <pod> --all-containers
kubectl logs -n <namespace> <pod> -c <container>
```

Add `--previous` to see the logs of a container before it restarted, and `-f` to follow them.

Logs of pods that no longer exist are in CloudWatch, see [Observability](https://wiki.systemseed.com/hosty/observability).

## Resources

CPU and memory used by the nodes, with the group of each node:

```bash
kubectl top nodes
kubectl get nodes -L groupName
```

CPU and memory used by the pods of a namespace, or by each container:

```bash
kubectl top pods -n <namespace>
kubectl top pods -n <namespace> --containers
```

The autoscaling of production, with its current and target use:

```bash
kubectl get hpa -n <project>-production
```
