{"slug":"kubernetes-kubectl-session-and-api-request-recording","title":"Kubernetes 'kubectl' session and API request recording","tags":["tailscale","containers","api"],"agent_summary":"Last validated: Jan 5, 2026","trigger_phrases":[],"runnable":false,"markdown":"\r\n# Kubernetes 'kubectl' session and API request recording\r\n\r\nLast validated: Jan 5, 2026\r\n\r\nTailscale Kubernetes Operator session recordingis currently [in beta](https://tailscale.com/docs/reference/tailscale-release-stages#beta).\r\n\r\nThe Tailscale Kubernetes Operator now supports recording all [Kubernetes API request events](https://tailscale.com/docs/features/kubernetes-operator/how-to/session-recording#kubernetes-api-request-events).\r\n\r\nIn Tailscale 1.70 and later, you can record [kubectl exec](https://kubernetes.io/docs/reference/kubectl/generated/kubectl_exec/), [kubectl debug](https://kubernetes.io/docs/reference/kubectl/generated/kubectl_debug/), [kubectl attach](https://kubernetes.io/docs/reference/kubectl/generated/kubectl_attach/), and [kubectl run](https://kubernetes.io/docs/reference/kubectl/generated/kubectl_run/) session contents, as well as all Kubernetes API requests that pass through the [Kubernetes API server proxy](https://tailscale.com/docs/features/kubernetes-operator/how-to/api-server-proxy).\r\n\r\nTailscale Kubernetes Operator session recordingis available for [the Personal and Enterprise plans](https://tailscale.com/pricing).\r\n\r\nRecorded sessions are sent to a configured [`tsrecorder`](https://tailscale.com/docs/features/tailscale-ssh/tailscale-ssh-session-recording#deploy-a-recorder-node) instance in your tailnet.\r\nThe `tsrecorder` supports storing recorded sessions in an S3-compatible storage or on disk.\r\n\r\nA recording contains:\r\n\r\n- The command sent in the `kubectl` call. For example, `kubectl exec -- cat /myfile.txt` will show up as `cat /myfile.txt`.\r\n- The session type being recorded (either `exec` or `attach`)\r\n- The contents of `stdout` and `stderr` from the attached terminal, but not `stdin`. This prevents the recording of sensitive input, such as passwords.\r\n- Session start timestamp.\r\n- Name and namespace of the `Pod` and name of the container being recorded.\r\n- Tailscale hostname of the API server proxy.\r\n- [Tailscale identity](https://tailscale.com/docs/concepts/tailscale-identity)that initiated the session:\r\n  - Tailscale hostname of the source device from which the `kubectl` session was initiated.\r\n  - If the source device is [tagged](https://tailscale.com/docs/features/tags), tags of the device.\r\n  - If the source device is not tagged, Tailscale user ID and login name.\r\n\r\nThe API server proxy sends session contents to `tsrecorder` over the tailnet, so the traffic is end-to-end encrypted using WireGuard, like any other tailnet traffic.\r\n\r\nYou can choose whether a `kubectl` session should be allowed ('fail open') or be forbidden ('fail closed') if the recording fails. For example, if a connection to tsrecorder cannot be established or fails.\r\n\r\n## [Kubernetes API request events](https://tailscale.com/docs/features/kubernetes-operator/how-to/session-recording\\#kubernetes-api-request-events)\r\n\r\nTailscale Kubernetes Operator API request recordingis currently [in beta](https://tailscale.com/docs/reference/tailscale-release-stages#beta).\r\n\r\nWith the Tailscale Kubernetes operator, you can record all Kubernetes API requests that pass through the [Kubernetes API server proxy](https://tailscale.com/docs/features/kubernetes-operator/how-to/api-server-proxy). This lets you create a detailed audit trail of cluster interactions for security and compliance purposes.\r\n\r\nA request event contains:\r\n\r\n- Timestamp of when the event occurred.\r\n- Detailed information about the Kubernetes API request, including:\r\n  - The verb such as `get`, `list`, `create`.\r\n  - The targeted resource such as `pods` and `services`.\r\n  - The namespace, name, API group, and version.\r\n- Full HTTP request details, including the method, path, request body and query parameters.\r\n- User agent of the client that made the request (for example, `kubectl/v1.33.3`).\r\n- Source Tailscale machine that the request came from.\r\n- Tailscale identity that initiated the API call, including:\r\n  - Tailscale hostname of the source device.\r\n  - If the source device is tagged and the tags of the device.\r\n  - If the source device is not tagged, the Tailscale user ID and login name.\r\n\r\nThis is all encapsulated in a general tsrecorder event of type `kubernetes-api-request`.\r\n\r\nThe API server proxy sends API request events to [`tsrecorder`](https://tailscale.com/docs/features/tailscale-ssh/tailscale-ssh-session-recording#deploy-a-recorder-node) over your tailnet, so the traffic is end-to-end encrypted using WireGuard, just like any other tailnet traffic.\r\n\r\n### [Enabling Kubernetes API request events](https://tailscale.com/docs/features/kubernetes-operator/how-to/session-recording\\#enabling-kubernetes-api-request-events)\r\n\r\nTo enable this feature, refer to the [following section](https://tailscale.com/docs/features/kubernetes-operator/how-to/session-recording#enabling-api-request-event-recording).\r\n\r\n## [Prerequisites](https://tailscale.com/docs/features/kubernetes-operator/how-to/session-recording\\#prerequisites)\r\n\r\n- Set up the Tailscale Kubernetes Operator with the [API server proxy](https://tailscale.com/docs/features/kubernetes-operator/how-to/api-server-proxy) enabled.\r\n- Deploy a [tagged](https://tailscale.com/docs/features/tags) [`tsrecorder` instance](https://tailscale.com/docs/features/tailscale-ssh/tailscale-ssh-session-recording#deploy-a-recorder-node).\r\nNote that you can also [deploy `tsrecorder` on Kubernetes using the operator](https://tailscale.com/docs/features/kubernetes-operator/how-to/tsrecorder).\r\n- Ensure that your [ACLs](https://tailscale.com/docs/features/access-control/acls) allow the operator to access port `80` of the `tsrecorder`.\r\n\r\n## [Configure the session recording](https://tailscale.com/docs/features/kubernetes-operator/how-to/session-recording\\#configure-the-session-recording)\r\n\r\nYou can configure session recording options using [grants](https://tailscale.com/docs/features/access-control/grants).\r\n\r\nGrants only configure how the API server proxy treats incoming connections; they do not configure tailnet device connectivity. To allow clients to connect, refer to the [API server proxy prerequisites](https://tailscale.com/docs/features/kubernetes-operator/how-to/api-server-proxy#prerequisites).\r\n\r\nYou must specify the source (the tailnet identity that starts the `kubectl` session), the destination (the API server proxy), and the `tsrecorder` instance. You can also specify the failure policy. The default failure policy is to fail open.\r\n\r\nThe following example:\r\n\r\n- Lets requests from `group:engineering` connect to the API server proxy on all operator instances tagged with `tag:k8s-operator` on port `443`.\r\n- Enforces session recording for `kubectl` sessions from [tailnet group](https://tailscale.com/docs/reference/syntax/policy-file#groups)`group:engineering` to all API server proxy instances tagged with `tag:k8s-operator`.\r\n- Configures the recorded sessions to be sent to a `tsrecorder` instance tagged with `tag:tsrecorder`.\r\n- Sets failure policy to \"fail closed\" (if the recording fails, forbid the session).\r\n\r\n```json\r\n\"acls\": [\\\r\n  {\\\r\n    \"action\": \"accept\",\\\r\n    \"src\": [\"group:engineering\"],\\\r\n    \"dst\": [\"tag:k8s-operator:443\"]\\\r\n  }\\\r\n],\r\n\"grants\": [\\\r\n  {\\\r\n    \"src\": [\"group:engineering\"],\\\r\n    \"dst\": [\"tag:k8s-operator\"],\\\r\n    \"app\": {\\\r\n      \"tailscale.com/cap/kubernetes\": [{\\\r\n        \"recorder\":        [\"tag:tsrecorder\"],\\\r\n        \"enforceRecorder\": true,\\\r\n      }],\\\r\n    },\\\r\n  },\\\r\n]\r\n```\r\n\r\nIf `tag:tsrecorder` resolves to multiple tailnet IP addresses, the API server proxy will send the recording to the first instance to which it succeeds at establishing a connection.\r\n\r\n### [Enabling API request event recording](https://tailscale.com/docs/features/kubernetes-operator/how-to/session-recording\\#enabling-api-request-event-recording)\r\n\r\nTo enable Kubernetes API request event recording, add `\"enableEvents\": true` to the `tailscale.com/cap/kubernetes` grant.\r\n\r\nWhen `enableEvents` is set to `true`, all Kubernetes API requests that pass through the proxy will be recorded, in addition to `kubectl` sessions.\r\n\r\nThe following example:\r\n\r\n- Lets requests from `group:engineering` connect to the API server proxy on all operator instances tagged with `tag:k8s-operator` on port `443`.\r\n- Configures the recorded sessions to be sent to a `tsrecorder` instance tagged with `tag:tsrecorder`.\r\n- Enables recording of Kubernetes API request events.\r\n\r\n```json\r\n\"acls\": [\\\r\n  {\\\r\n    \"action\": \"accept\",\\\r\n    \"src\": [\"group:engineering\"],\\\r\n    \"dst\": [\"tag:k8s-operator:443\"]\\\r\n  }\\\r\n],\r\n\"grants\": [\\\r\n  {\\\r\n    \"src\": [\"group:engineering\"],\\\r\n    \"dst\": [\"tag:k8s-operator\"],\\\r\n    \"app\": {\\\r\n      \"tailscale.com/cap/kubernetes\": [{\\\r\n        \"recorder\":        [\"tag:tsrecorder\"],\\\r\n        \"enableEvents\":    true,\\\r\n      }],\\\r\n    },\\\r\n  },\\\r\n]\r\n```\r\n\r\n### [Combine session recording and group impersonation in grant rules](https://tailscale.com/docs/features/kubernetes-operator/how-to/session-recording\\#combine-session-recording-and-group-impersonation-in-grant-rules)\r\n\r\nA grant can also combine session recording rules and [API server proxy impersonation rules](https://tailscale.com/docs/features/kubernetes-operator/how-to/api-server-proxy#impersonating-kubernetes-groups-with-grants).\r\n\r\nThe following example:\r\n\r\n- Lets requests from `group:engineering` connect to the API server proxy on all operator instances tagged with `tag:k8s-operator` on port `443`.\r\n\r\n- Configures session recording for `kubectl` sessions from group `group:engineering` to all operator instances tagged with `tag:k8s-operator`.\r\n\r\n- Configures the recorded sessions to be sent to a tsrecorder instance tagged with `tag:tsrecorder`.\r\n\r\n- Configures that requests from `group:engineering` should be impersonated as from Kubernetes group `system:masters`.\r\n\r\n\r\n```json\r\n\"acls\": [\\\r\n  {\\\r\n    \"action\": \"accept\",\\\r\n    \"src\": [\"group:engineering\"],\\\r\n    \"dst\": [\"tag:k8s-operator:443\"]\\\r\n  }\\\r\n],\r\n\"grants\": [\\\r\n  {\\\r\n    \"src\": [\"group:engineering\"],\\\r\n    \"dst\": [\"tag:k8s-operator\"],\\\r\n    \"app\": {\\\r\n      \"tailscale.com/cap/kubernetes\": [{\\\r\n        \"impersonate\": {\\\r\n          \"groups\": [\"system:masters\"],\\\r\n        },\\\r\n        \"recorder\": [\"tag:tsrecorder\"],\\\r\n      }],\\\r\n    },\\\r\n  },\\\r\n]\r\n```\r\n\r\n### [Enforce recording of all sessions](https://tailscale.com/docs/features/kubernetes-operator/how-to/session-recording\\#enforce-recording-of-all-sessions)\r\n\r\nTo ensure the recording of all `kubectl` sessions, use the wildcard syntax (`*`) as the grant's source and/or destination.\r\n\r\nThe following example:\r\n\r\n- Enforces recording of all `kubectl` sessions from any source to any API server proxy instance.\r\n\r\n- Configures the recording to be sent to tsrecorder instance tagged with `tag:tsrecorder`.\r\n\r\n\r\n```json\r\n\"grants\": [\\\r\n  {\\\r\n    \"src\": [\"*\"],\\\r\n    \"dst\": [\"*\"],\\\r\n    \"app\": {\\\r\n      \"tailscale.com/cap/kubernetes\": [{\\\r\n        \"recorder\":        [\"tag:tsrecorder\"],\\\r\n        \"enforceRecorder\": true,\\\r\n      }],\\\r\n    },\\\r\n  },\\\r\n]\r\n```\r\n\r\n## [Known issues and limitations](https://tailscale.com/docs/features/kubernetes-operator/how-to/session-recording\\#known-issues-and-limitations)\r\n\r\n- In some cases, if an established connection to `tsrecorder` fails midway (because the `tsrecorder` instance fails), the session will be allowed to continue even if the policy is to fail closed.\r\n\r\n![Project Logo](https://cdn.brandfetch.io/tailscale.com/fallback/lettermark/theme/dark/h/256/w/256/icon?c=1bfwsmEH20zzEfSNTed)\r\n\r\nAsk AI\r\n\r\nreCAPTCHA\r\n\r\nRecaptcha requires verification.\r\n\r\nprotected by **reCAPTCHA**\r\n","html":"<h1>Kubernetes 'kubectl' session and API request recording</h1>\n<p>Last validated: Jan 5, 2026</p>\n<p>Tailscale Kubernetes Operator session recordingis currently <a href=\"https://tailscale.com/docs/reference/tailscale-release-stages#beta\">in beta</a>.</p>\n<p>The Tailscale Kubernetes Operator now supports recording all <a href=\"https://tailscale.com/docs/features/kubernetes-operator/how-to/session-recording#kubernetes-api-request-events\">Kubernetes API request events</a>.</p>\n<p>In Tailscale 1.70 and later, you can record <a href=\"https://kubernetes.io/docs/reference/kubectl/generated/kubectl_exec/\">kubectl exec</a>, <a href=\"https://kubernetes.io/docs/reference/kubectl/generated/kubectl_debug/\">kubectl debug</a>, <a href=\"https://kubernetes.io/docs/reference/kubectl/generated/kubectl_attach/\">kubectl attach</a>, and <a href=\"https://kubernetes.io/docs/reference/kubectl/generated/kubectl_run/\">kubectl run</a> session contents, as well as all Kubernetes API requests that pass through the <a href=\"https://tailscale.com/docs/features/kubernetes-operator/how-to/api-server-proxy\">Kubernetes API server proxy</a>.</p>\n<p>Tailscale Kubernetes Operator session recordingis available for <a href=\"https://tailscale.com/pricing\">the Personal and Enterprise plans</a>.</p>\n<p>Recorded sessions are sent to a configured <a href=\"https://tailscale.com/docs/features/tailscale-ssh/tailscale-ssh-session-recording#deploy-a-recorder-node\"><code>tsrecorder</code></a> instance in your tailnet.\r\nThe <code>tsrecorder</code> supports storing recorded sessions in an S3-compatible storage or on disk.</p>\n<p>A recording contains:</p>\n<ul>\n<li>The command sent in the <code>kubectl</code> call. For example, <code>kubectl exec -- cat /myfile.txt</code> will show up as <code>cat /myfile.txt</code>.</li>\n<li>The session type being recorded (either <code>exec</code> or <code>attach</code>)</li>\n<li>The contents of <code>stdout</code> and <code>stderr</code> from the attached terminal, but not <code>stdin</code>. This prevents the recording of sensitive input, such as passwords.</li>\n<li>Session start timestamp.</li>\n<li>Name and namespace of the <code>Pod</code> and name of the container being recorded.</li>\n<li>Tailscale hostname of the API server proxy.</li>\n<li><a href=\"https://tailscale.com/docs/concepts/tailscale-identity\">Tailscale identity</a>that initiated the session:\n<ul>\n<li>Tailscale hostname of the source device from which the <code>kubectl</code> session was initiated.</li>\n<li>If the source device is <a href=\"https://tailscale.com/docs/features/tags\">tagged</a>, tags of the device.</li>\n<li>If the source device is not tagged, Tailscale user ID and login name.</li>\n</ul>\n</li>\n</ul>\n<p>The API server proxy sends session contents to <code>tsrecorder</code> over the tailnet, so the traffic is end-to-end encrypted using WireGuard, like any other tailnet traffic.</p>\n<p>You can choose whether a <code>kubectl</code> session should be allowed ('fail open') or be forbidden ('fail closed') if the recording fails. For example, if a connection to tsrecorder cannot be established or fails.</p>\n<h2><a href=\"https://tailscale.com/docs/features/kubernetes-operator/how-to/session-recording#kubernetes-api-request-events\">Kubernetes API request events</a></h2>\n<p>Tailscale Kubernetes Operator API request recordingis currently <a href=\"https://tailscale.com/docs/reference/tailscale-release-stages#beta\">in beta</a>.</p>\n<p>With the Tailscale Kubernetes operator, you can record all Kubernetes API requests that pass through the <a href=\"https://tailscale.com/docs/features/kubernetes-operator/how-to/api-server-proxy\">Kubernetes API server proxy</a>. This lets you create a detailed audit trail of cluster interactions for security and compliance purposes.</p>\n<p>A request event contains:</p>\n<ul>\n<li>Timestamp of when the event occurred.</li>\n<li>Detailed information about the Kubernetes API request, including:\n<ul>\n<li>The verb such as <code>get</code>, <code>list</code>, <code>create</code>.</li>\n<li>The targeted resource such as <code>pods</code> and <code>services</code>.</li>\n<li>The namespace, name, API group, and version.</li>\n</ul>\n</li>\n<li>Full HTTP request details, including the method, path, request body and query parameters.</li>\n<li>User agent of the client that made the request (for example, <code>kubectl/v1.33.3</code>).</li>\n<li>Source Tailscale machine that the request came from.</li>\n<li>Tailscale identity that initiated the API call, including:\n<ul>\n<li>Tailscale hostname of the source device.</li>\n<li>If the source device is tagged and the tags of the device.</li>\n<li>If the source device is not tagged, the Tailscale user ID and login name.</li>\n</ul>\n</li>\n</ul>\n<p>This is all encapsulated in a general tsrecorder event of type <code>kubernetes-api-request</code>.</p>\n<p>The API server proxy sends API request events to <a href=\"https://tailscale.com/docs/features/tailscale-ssh/tailscale-ssh-session-recording#deploy-a-recorder-node\"><code>tsrecorder</code></a> over your tailnet, so the traffic is end-to-end encrypted using WireGuard, just like any other tailnet traffic.</p>\n<h3><a href=\"https://tailscale.com/docs/features/kubernetes-operator/how-to/session-recording#enabling-kubernetes-api-request-events\">Enabling Kubernetes API request events</a></h3>\n<p>To enable this feature, refer to the <a href=\"https://tailscale.com/docs/features/kubernetes-operator/how-to/session-recording#enabling-api-request-event-recording\">following section</a>.</p>\n<h2><a href=\"https://tailscale.com/docs/features/kubernetes-operator/how-to/session-recording#prerequisites\">Prerequisites</a></h2>\n<ul>\n<li>Set up the Tailscale Kubernetes Operator with the <a href=\"https://tailscale.com/docs/features/kubernetes-operator/how-to/api-server-proxy\">API server proxy</a> enabled.</li>\n<li>Deploy a <a href=\"https://tailscale.com/docs/features/tags\">tagged</a> <a href=\"https://tailscale.com/docs/features/tailscale-ssh/tailscale-ssh-session-recording#deploy-a-recorder-node\"><code>tsrecorder</code> instance</a>.\r\nNote that you can also <a href=\"https://tailscale.com/docs/features/kubernetes-operator/how-to/tsrecorder\">deploy <code>tsrecorder</code> on Kubernetes using the operator</a>.</li>\n<li>Ensure that your <a href=\"https://tailscale.com/docs/features/access-control/acls\">ACLs</a> allow the operator to access port <code>80</code> of the <code>tsrecorder</code>.</li>\n</ul>\n<h2><a href=\"https://tailscale.com/docs/features/kubernetes-operator/how-to/session-recording#configure-the-session-recording\">Configure the session recording</a></h2>\n<p>You can configure session recording options using <a href=\"https://tailscale.com/docs/features/access-control/grants\">grants</a>.</p>\n<p>Grants only configure how the API server proxy treats incoming connections; they do not configure tailnet device connectivity. To allow clients to connect, refer to the <a href=\"https://tailscale.com/docs/features/kubernetes-operator/how-to/api-server-proxy#prerequisites\">API server proxy prerequisites</a>.</p>\n<p>You must specify the source (the tailnet identity that starts the <code>kubectl</code> session), the destination (the API server proxy), and the <code>tsrecorder</code> instance. You can also specify the failure policy. The default failure policy is to fail open.</p>\n<p>The following example:</p>\n<ul>\n<li>Lets requests from <code>group:engineering</code> connect to the API server proxy on all operator instances tagged with <code>tag:k8s-operator</code> on port <code>443</code>.</li>\n<li>Enforces session recording for <code>kubectl</code> sessions from <a href=\"https://tailscale.com/docs/reference/syntax/policy-file#groups\">tailnet group</a><code>group:engineering</code> to all API server proxy instances tagged with <code>tag:k8s-operator</code>.</li>\n<li>Configures the recorded sessions to be sent to a <code>tsrecorder</code> instance tagged with <code>tag:tsrecorder</code>.</li>\n<li>Sets failure policy to \"fail closed\" (if the recording fails, forbid the session).</li>\n</ul>\n<pre><code class=\"language-json\">\"acls\": [\\\r\n  {\\\r\n    \"action\": \"accept\",\\\r\n    \"src\": [\"group:engineering\"],\\\r\n    \"dst\": [\"tag:k8s-operator:443\"]\\\r\n  }\\\r\n],\r\n\"grants\": [\\\r\n  {\\\r\n    \"src\": [\"group:engineering\"],\\\r\n    \"dst\": [\"tag:k8s-operator\"],\\\r\n    \"app\": {\\\r\n      \"tailscale.com/cap/kubernetes\": [{\\\r\n        \"recorder\":        [\"tag:tsrecorder\"],\\\r\n        \"enforceRecorder\": true,\\\r\n      }],\\\r\n    },\\\r\n  },\\\r\n]\n</code></pre>\n<p>If <code>tag:tsrecorder</code> resolves to multiple tailnet IP addresses, the API server proxy will send the recording to the first instance to which it succeeds at establishing a connection.</p>\n<h3><a href=\"https://tailscale.com/docs/features/kubernetes-operator/how-to/session-recording#enabling-api-request-event-recording\">Enabling API request event recording</a></h3>\n<p>To enable Kubernetes API request event recording, add <code>\"enableEvents\": true</code> to the <code>tailscale.com/cap/kubernetes</code> grant.</p>\n<p>When <code>enableEvents</code> is set to <code>true</code>, all Kubernetes API requests that pass through the proxy will be recorded, in addition to <code>kubectl</code> sessions.</p>\n<p>The following example:</p>\n<ul>\n<li>Lets requests from <code>group:engineering</code> connect to the API server proxy on all operator instances tagged with <code>tag:k8s-operator</code> on port <code>443</code>.</li>\n<li>Configures the recorded sessions to be sent to a <code>tsrecorder</code> instance tagged with <code>tag:tsrecorder</code>.</li>\n<li>Enables recording of Kubernetes API request events.</li>\n</ul>\n<pre><code class=\"language-json\">\"acls\": [\\\r\n  {\\\r\n    \"action\": \"accept\",\\\r\n    \"src\": [\"group:engineering\"],\\\r\n    \"dst\": [\"tag:k8s-operator:443\"]\\\r\n  }\\\r\n],\r\n\"grants\": [\\\r\n  {\\\r\n    \"src\": [\"group:engineering\"],\\\r\n    \"dst\": [\"tag:k8s-operator\"],\\\r\n    \"app\": {\\\r\n      \"tailscale.com/cap/kubernetes\": [{\\\r\n        \"recorder\":        [\"tag:tsrecorder\"],\\\r\n        \"enableEvents\":    true,\\\r\n      }],\\\r\n    },\\\r\n  },\\\r\n]\n</code></pre>\n<h3><a href=\"https://tailscale.com/docs/features/kubernetes-operator/how-to/session-recording#combine-session-recording-and-group-impersonation-in-grant-rules\">Combine session recording and group impersonation in grant rules</a></h3>\n<p>A grant can also combine session recording rules and <a href=\"https://tailscale.com/docs/features/kubernetes-operator/how-to/api-server-proxy#impersonating-kubernetes-groups-with-grants\">API server proxy impersonation rules</a>.</p>\n<p>The following example:</p>\n<ul>\n<li>\n<p>Lets requests from <code>group:engineering</code> connect to the API server proxy on all operator instances tagged with <code>tag:k8s-operator</code> on port <code>443</code>.</p>\n</li>\n<li>\n<p>Configures session recording for <code>kubectl</code> sessions from group <code>group:engineering</code> to all operator instances tagged with <code>tag:k8s-operator</code>.</p>\n</li>\n<li>\n<p>Configures the recorded sessions to be sent to a tsrecorder instance tagged with <code>tag:tsrecorder</code>.</p>\n</li>\n<li>\n<p>Configures that requests from <code>group:engineering</code> should be impersonated as from Kubernetes group <code>system:masters</code>.</p>\n</li>\n</ul>\n<pre><code class=\"language-json\">\"acls\": [\\\r\n  {\\\r\n    \"action\": \"accept\",\\\r\n    \"src\": [\"group:engineering\"],\\\r\n    \"dst\": [\"tag:k8s-operator:443\"]\\\r\n  }\\\r\n],\r\n\"grants\": [\\\r\n  {\\\r\n    \"src\": [\"group:engineering\"],\\\r\n    \"dst\": [\"tag:k8s-operator\"],\\\r\n    \"app\": {\\\r\n      \"tailscale.com/cap/kubernetes\": [{\\\r\n        \"impersonate\": {\\\r\n          \"groups\": [\"system:masters\"],\\\r\n        },\\\r\n        \"recorder\": [\"tag:tsrecorder\"],\\\r\n      }],\\\r\n    },\\\r\n  },\\\r\n]\n</code></pre>\n<h3><a href=\"https://tailscale.com/docs/features/kubernetes-operator/how-to/session-recording#enforce-recording-of-all-sessions\">Enforce recording of all sessions</a></h3>\n<p>To ensure the recording of all <code>kubectl</code> sessions, use the wildcard syntax (<code>*</code>) as the grant's source and/or destination.</p>\n<p>The following example:</p>\n<ul>\n<li>\n<p>Enforces recording of all <code>kubectl</code> sessions from any source to any API server proxy instance.</p>\n</li>\n<li>\n<p>Configures the recording to be sent to tsrecorder instance tagged with <code>tag:tsrecorder</code>.</p>\n</li>\n</ul>\n<pre><code class=\"language-json\">\"grants\": [\\\r\n  {\\\r\n    \"src\": [\"*\"],\\\r\n    \"dst\": [\"*\"],\\\r\n    \"app\": {\\\r\n      \"tailscale.com/cap/kubernetes\": [{\\\r\n        \"recorder\":        [\"tag:tsrecorder\"],\\\r\n        \"enforceRecorder\": true,\\\r\n      }],\\\r\n    },\\\r\n  },\\\r\n]\n</code></pre>\n<h2><a href=\"https://tailscale.com/docs/features/kubernetes-operator/how-to/session-recording#known-issues-and-limitations\">Known issues and limitations</a></h2>\n<ul>\n<li>In some cases, if an established connection to <code>tsrecorder</code> fails midway (because the <code>tsrecorder</code> instance fails), the session will be allowed to continue even if the policy is to fail closed.</li>\n</ul>\n<p><img src=\"https://cdn.brandfetch.io/tailscale.com/fallback/lettermark/theme/dark/h/256/w/256/icon?c=1bfwsmEH20zzEfSNTed\" alt=\"Project Logo\"></p>\n<p>Ask AI</p>\n<p>reCAPTCHA</p>\n<p>Recaptcha requires verification.</p>\n<p>protected by <strong>reCAPTCHA</strong></p>\n"}