Terminal
Open a shell in a pod of a deployment, who may do it, what limits apply and what is recorded.
Sometimes the only way to understand a failing pod is to look inside it: read a file, run a query, check an environment variable. The Terminal opens a shell, or runs one command, in a pod of a deployment, without kubectl access to the cluster and without a VPN. It is the most powerful thing Wardn lets a person do, since it runs arbitrary code next to a workload's secrets and network, so it is deliberate, narrow, limited in time, attributable to one person and recorded. The reasoning is in Security model.
What a session is
One person, one pod, one container and one command (a shell by default), for a bounded time. Wardn runs it as the deployment's own service account, through the operator in the cluster, so Kubernetes decides what the shell may do. The operator checks again, in the cluster, that the pod belongs to the deployment: a pod that is not one of the deployment's, however it is named, is refused. Nothing connects in to the cluster; the session travels over the connection the operator already holds.
What must be true
| Requirement | Where to set it |
|---|---|
| You can deploy the deployment (you hold manage rights on it), or you were named for terminals on it, and the environment allows it. | Who may open one |
| The cluster allows terminals: Open terminals in pods is on. It is off by default. | The cluster's Operator tab. Needs cluster:manage and cluster:exec, and is recorded in Activity. |
| The cluster's operator is connected and supports terminals. | Connect a cluster |
| The deployment's service account may exec in its namespace. | The Role below, created by whoever owns the cluster. |
| The deployment is not a preview and the namespace is not reserved. | Previews run code that has not been reviewed, so they never take shells. Use logs and events for a preview. kube-system, kube-public, kube-node-lease and the operator's namespace are refused. |
Who may open one
A terminal follows deploy access. Anyone who can manage a deployment can open a terminal in its pods: the person who created it and its owner team, people given deploy rights on it, on its cluster or on its environment, and organization Owners. There is no separate grant, no approval and no time box. Every session is recorded in Activity, and the team that owns the deployment is told when one opens.
Each environment decides who may open one in Environment › Settings › Terminal:
| Setting | Choices |
|---|---|
| Who can open one | Everyone who deploys here (the default), or Named people only: only people who were given pod:exec by name. Choose this for environments where a shell should be a rare, deliberate step, such as production. |
| Tell the owner team | On by default. When someone opens a shell in a deployment, the team that owns it gets a notice in its inbox. The person who opened it is not told about their own shell. |
pod:exec still works as an explicit grant on the organization, an environment, a cluster or a deployment, and it is the only way in for an environment set to Named people only. No organization role holds it, not even Owner, and no wildcard grants it. Viewers are refused. Agents and service accounts never get a terminal, and neither does an API token from deploying: a token may use pod:exec only if its ceiling names it, and then only for its owner. See Roles and grants to make a role and grant it.
A pod you cannot see answers 404 before access is asked, so a refusal never confirms that a pod exists. Access is checked when the session is requested and again when it opens, so access revoked, or an environment switched to named people, in between stops it. A session already open is not ended by a revocation; end it with terminate. You can always end your own session.
What the shell can and cannot reach
A shell opens only in a pod Wardn applied for that deployment, in the deployment's namespace, on the cluster you chose. It runs as the namespace's wardn-deployer service account, so Kubernetes enforces the namespace boundary as well. It cannot reach other deployments' pods, other namespaces, nodes, or Wardn's own namespace, and Wardn offers no port-forward or proxy. A pod someone else started in the same namespace is refused.
Inside the pod, the shell has whatever the app has: its environment variables, its mounted secrets, its service account token and its network. Wardn limits which pod a person reaches, not what that pod can reach. Network policies and least-privilege credentials for the app are what limit that, so give an app only the access it needs, and keep production on Named people only where a shell should be rare.
Open a terminal
Open the deployment, find the pod under Resources or the app's pods, and choose Open a shell. Pods that cannot take one say why: "No running container to exec into", "Previews don't take shells: they run code that has not been reviewed", or "Terminals are off on this cluster. Someone with cluster:exec turns them on in its Operator tab."
Choose the Container and, if the container has no /bin/sh, This container has no shell tells you so.
On a production-tier cluster, enter a Reason, 10 to 500 characters ("Reason, required on production"). It is shown in Activity and kept on the session.
The Terminal opens as a sheet and connects. Choose New session for another, and Hide terminal to put it away: sessions keep running while hidden.
The cluster's tier (production or not, set on the cluster) decides whether a reason is required and whether the session is recorded by default. It is separate from an environment's class.
Limits
Each is an organization setting with a hard bound, so a forgotten shell does not stay open:
| Setting | Default | Bounds |
|---|---|---|
| Idle timeout (no input and no output) | 15 minutes | 1 minute to 2 hours |
| Maximum length | 1 hour | 5 minutes to 8 hours |
| Sessions per person | 2 | 1 to 10 |
| Sessions per cluster | 10 | 1 to 100 |
| Terminal requests per person | 10 a minute | fixed |
| Recording size per session | 64 MiB | fixed |
The operator enforces the maximum length too, so a lost connection to Wardn does not leave a shell running. The settings have no screen yet; read and change them through the API with GET and PUT /exec-settings (org:read and org:manage). A change is recorded as org.exec_settings_changed.
api() { curl -fsS -H "Authorization: Bearer $WARDN_TOKEN" -H 'Content-Type: application/json' "$@"; }
api "$WARDN_API_URL/api/v1/exec-settings"
api -X PUT "$WARDN_API_URL/api/v1/exec-settings" -d '{
"idleTimeoutSeconds": 900,
"maxDurationSeconds": 3600,
"maxPerPerson": 2,
"maxPerCluster": 10,
"recording": "production",
"recordingRetentionDays": 90
}'What is recorded
Every session is in Activity and in the tamper-evident chain (Activity and export):
exec.started: who, the reason, cluster, deployment, namespace, pod, container, command, and whether the output is recorded.exec.ended: how long, how it ended and the exit code.exec.terminated: who asked for a session to end.
Output is recorded when the organization's recording setting says so: production (the default: sessions on production-tier clusters), all or off. Only what the terminal prints (standard output and error) is recorded. What you type is relayed and never stored, though with a terminal the shell echoes it back and that echo is recorded, as it would be on your screen. A password typed at a prompt that does not echo is not. Recordings are kept for recordingRetentionDays (default 90, 1 to 3650), checked for integrity when read, and read with audit:read. If a recording cannot be stored, or reaches 64 MiB, the session is ended rather than continue unrecorded. Session content is never written to Wardn's logs.
End a session
A session ends when the command exits, when you close it, at the idle timeout or the maximum length, when the connection between Wardn and the cluster is lost, or when someone ends it.
api "$WARDN_API_URL/api/v1/exec-sessions?live=true" # live sessions (audit:read)
api -X POST "$WARDN_API_URL/api/v1/exec-sessions/$SESSION_ID/terminate" # end one (org:manage)
api "$WARDN_API_URL/api/v1/exec-sessions/$SESSION_ID/recording" # the recorded output (audit:read)GET /exec-sessions also filters by deploymentId and userId. The kill reaches every part of Wardn and is retried, so a lost notice is not a missed kill.
Let a namespace be exec'd into
Kubernetes checks pods/exec against the deployment's service account, so a namespace whose wardn-deployer account lacks it cannot be opened at all, and the session ends with the API server's message. Granting it is the cluster owner's decision, per namespace:
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata: {name: wardn-exec, namespace: shop}
rules:
- {apiGroups: [""], resources: [pods], verbs: [get]}
- {apiGroups: [""], resources: [pods/exec], verbs: [create]}
- {apiGroups: [""], resources: [pods/log], verbs: [get]} # for pod logs
- {apiGroups: [apps], resources: [replicasets], verbs: [get]} # to walk a pod up to its Deployment
- {apiGroups: [batch], resources: [jobs], verbs: [get]} # to walk a Job's pod up to its CronJob
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata: {name: wardn-exec, namespace: shop}
roleRef: {apiGroup: rbac.authorization.k8s.io, kind: Role, name: wardn-exec}
subjects:
- {kind: ServiceAccount, name: wardn-deployer, namespace: shop}The operator itself gains nothing: it holds no pods/exec.
When a session is refused
| Answer | Meaning and fix |
|---|---|
403 exec.not_deployer | You can open a terminal in a deployment you deploy. Ask someone who does, or an admin. |
403 exec.named_only | The environment allows named people only. Ask an admin. |
403 exec.pod_foreign | The pod is not one Wardn applied for this deployment. |
404 pod.not_found | The pod does not exist, or you cannot see it. |
400 exec.reason_required | A production-tier cluster needs a reason of 10 characters or more. |
400 exec.namespace_reserved | The namespace is one Wardn never opens. |
409 exec.capability_off | The cluster's Open terminals in pods switch is off. |
409 exec.operator_unsupported | The operator is too old to take terminals. Upgrade it. |
409 exec.preview | Previews take no shells. |
409 exec.limit_person, exec.limit_cluster, exec.rate_limited | Too many sessions open, or too many requests. Close one or wait. |
503 exec.operator_offline | The cluster's operator is not connected. Try again when it is. |
Logs and restarts
Logs need no terminal and no switch: a pod's Logs need only deployment:read. Restarting a pod needs deployment:sync. They are the way to debug a preview.
Next
Roles and grants
Name people for terminals where an environment allows named people only.
wardn exec
The same from your terminal.
Timelines and Activity
Find a session's start and end in Activity.
Related: Security model, Connect a cluster.