Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Contain Kubernetes token setup and permission diagnostics

pulse-triage[bot]24c803f7e049
diff --git a/docs/KUBERNETES.md b/docs/KUBERNETES.md
index 13745ca28f..28f3fce498 100644
--- a/docs/KUBERNETES.md
+++ b/docs/KUBERNETES.md
@@ -70,30 +70,75 @@ the legacy `API_TOKENS` server environment variable.
On your kubectl workstation, save only the token in a private, regular file
outside your GitOps repository. Do not paste it into a shell assignment, a
-`--from-literal` argument, a Helm value or the DaemonSet YAML:
+`--from-literal` argument, a Helm value or the DaemonSet YAML. Run these Bash
+steps as the credential's owner, not with `sudo`. Stop if preparation or the
+editor fails; do not continue to Secret creation. Existing token contents are
+preserved until you deliberately edit them. Symlinked paths and non-regular
+token files are refused before opening the editor:
```bash
-umask 077
-mkdir -p "$HOME/.config/pulse"
-chmod 700 "$HOME/.config/pulse"
-touch "$HOME/.config/pulse/kubernetes-agent-token"
-chmod 600 "$HOME/.config/pulse/kubernetes-agent-token"
-vi "$HOME/.config/pulse/kubernetes-agent-token"
+(
+ set -eu
+ umask 077
+ config_dir="$HOME/.config/pulse"
+ token_file="$config_dir/kubernetes-agent-token"
+ if [ -L "$HOME/.config" ] || [ -L "$config_dir" ] || [ -L "$token_file" ]; then
+ printf 'Refusing a symlinked credential path.\n' >&2
+ exit 1
+ fi
+ for directory in "$HOME/.config" "$config_dir"; do
+ if [ -e "$directory" ] && { [ ! -d "$directory" ] || [ ! -O "$directory" ]; }; then
+ printf 'Credential directories must belong to the current user.\n' >&2
+ exit 1
+ fi
+ done
+ if [ -e "$token_file" ] && { [ ! -f "$token_file" ] || [ ! -O "$token_file" ]; }; then
+ printf 'Token file must be a regular file owned by the current user.\n' >&2
+ exit 1
+ fi
+ mkdir -p "$config_dir"
+ chmod 700 "$config_dir"
+ touch "$token_file"
+ chmod 600 "$token_file"
+ vi "$token_file"
+)
```
After saving the token in the editor, create the Secret in the same namespace
-as the agent. The generated Secret goes directly to kubectl, not to your
-terminal or a checked-in manifest. The subshell stops on either pipeline's
+as the agent. This is a provisioning operation that can change cluster state,
+not a diagnostic for a missing reading. Check your current kubectl context and
+intended namespace privately before proceeding. The generated Secret goes
+directly to kubectl, not to your terminal or a checked-in manifest. Recheck the
+credential path before either pipeline; an empty, unreadable or unsafe file
+stops before contacting the cluster. The subshell stops on either pipeline's
failure; do not continue to the agent deployment if it fails:
```bash
(
set -euo pipefail
- test -s "$HOME/.config/pulse/kubernetes-agent-token"
+ umask 077
+ config_dir="$HOME/.config/pulse"
+ token_file="$config_dir/kubernetes-agent-token"
+ if [ -L "$HOME/.config" ] || [ -L "$config_dir" ] || [ -L "$token_file" ]; then
+ printf 'Refusing a symlinked credential path.\n' >&2
+ exit 1
+ fi
+ for directory in "$HOME/.config" "$config_dir"; do
+ if [ ! -d "$directory" ] || [ ! -O "$directory" ]; then
+ printf 'Credential directories must belong to the current user.\n' >&2
+ exit 1
+ fi
+ done
+ if [ ! -f "$token_file" ] || [ ! -O "$token_file" ] || [ ! -r "$token_file" ] || [ ! -s "$token_file" ]; then
+ printf 'Token file must be owned, readable, regular and non-empty.\n' >&2
+ exit 1
+ fi
+ chmod 700 "$config_dir"
+ chmod 600 "$token_file"
kubectl create namespace pulse --dry-run=client -o yaml | \
kubectl apply --server-side --field-manager=pulse-agent-setup -f -
kubectl -n pulse create secret generic pulse-agent-env \
- --from-file=PULSE_TOKEN="$HOME/.config/pulse/kubernetes-agent-token" \
+ --from-file=PULSE_TOKEN="$token_file" \
--dry-run=client -o yaml | \
kubectl apply --server-side --field-manager=pulse-agent-setup -f -
)
@@ -378,6 +423,27 @@ Talos Linux is immutable, so you cannot install the agent via the shell script.
## 4. Troubleshooting
-- **Agent not showing in UI**: Check logs for the DaemonSet pods, for example: `kubectl logs -l app=pulse-agent -n pulse`.
-- **"Permission Denied" on metrics**: Ensure `securityContext.privileged: true` is set or proper capabilities are added.
-- **Connection Refused**: Ensure `PULSE_URL` is correct and reachable from the agent pods.
+Start with the affected pod's existing status and a bounded, locally reviewed
+log excerpt around the original failure. Missing usage, missing inventory and
+a rejected Pulse report are different failures:
+
+| Observation | What to check without widening access |
+| --- | --- |
+| Pulse rejects reporting with HTTP 401/403 | Compare the intended Pulse server, token scopes and cluster identity with the existing configuration. `kubernetes:report` authorises Kubernetes reporting; host reporting also needs `agent:report`. Use the [agent authentication checks](UNIFIED_AGENT.md#agent-lookup-returns-http-401-or-403), not an administrator token or a new installation. |
+| Kubernetes API reports Forbidden | Check the pod's service account and the exact denied API resource against its Role/ClusterRole. Running a pod as root or privileged does not grant Kubernetes API permissions. Do not add `cluster-admin`, Secret reads or `nodes/proxy` merely to diagnose a missing reading. |
+| Inventory appears but CPU/memory usage is absent | Check whether the cluster's `metrics.k8s.io` service and its intended read permissions are available. Pulse can continue with inventory-only reporting when usage collection fails; missing usage is not zero. Host mounts and privileged mode are a separate, deliberate node-telemetry choice, not a repair for API metrics access. |
+| Connection refused or TLS validation fails | Check the existing `PULSE_URL` and network path from the agent pod, not just your browser. A refusal is not an authentication error; retain certificate verification and do not replace a token or expose Pulse to bypass it. |
+
+An applied Secret or running pod is not proof that Pulse accepted a fresh report
+or collected every resource. Keep expected inventory and usage separate when
+checking the ordinary view. Do not reapply the Secret, restart pods, enable
+Debug, change cluster permissions or rerun provisioning just to complete a
+report. A deliberate token rotation is separate maintenance and needs the
+restart described above.
+
+Keep tokens, Secret YAML, kubeconfigs, Helm values, pod environments and full
+logs private. Use the original time, status, API resource and a manually
+redacted error if help is needed; use consistent aliases for cluster, namespace
+and pod names. Do not publish `kubectl get secret -o yaml`, full pod descriptions
+or a broad label-selected log dump. Existing observations or unknowns are
+valid evidence; see [safe evidence collection](TROUBLESHOOTING.md#collect-diagnostics-safely).
diff --git a/frontend-modern/public/docs/KUBERNETES.md b/frontend-modern/public/docs/KUBERNETES.md
index 13745ca28f..28f3fce498 100644
--- a/frontend-modern/public/docs/KUBERNETES.md
+++ b/frontend-modern/public/docs/KUBERNETES.md
@@ -70,30 +70,75 @@ the legacy `API_TOKENS` server environment variable.
On your kubectl workstation, save only the token in a private, regular file
outside your GitOps repository. Do not paste it into a shell assignment, a
-`--from-literal` argument, a Helm value or the DaemonSet YAML:
+`--from-literal` argument, a Helm value or the DaemonSet YAML. Run these Bash
+steps as the credential's owner, not with `sudo`. Stop if preparation or the
+editor fails; do not continue to Secret creation. Existing token contents are
+preserved until you deliberately edit them. Symlinked paths and non-regular
+token files are refused before opening the editor:
```bash
-umask 077
-mkdir -p "$HOME/.config/pulse"
-chmod 700 "$HOME/.config/pulse"
-touch "$HOME/.config/pulse/kubernetes-agent-token"
-chmod 600 "$HOME/.config/pulse/kubernetes-agent-token"
-vi "$HOME/.config/pulse/kubernetes-agent-token"
+(
+ set -eu
+ umask 077
+ config_dir="$HOME/.config/pulse"
+ token_file="$config_dir/kubernetes-agent-token"
+ if [ -L "$HOME/.config" ] || [ -L "$config_dir" ] || [ -L "$token_file" ]; then
+ printf 'Refusing a symlinked credential path.\n' >&2
+ exit 1
+ fi
+ for directory in "$HOME/.config" "$config_dir"; do
+ if [ -e "$directory" ] && { [ ! -d "$directory" ] || [ ! -O "$directory" ]; }; then
+ printf 'Credential directories must belong to the current user.\n' >&2
+ exit 1
+ fi
+ done
+ if [ -e "$token_file" ] && { [ ! -f "$token_file" ] || [ ! -O "$token_file" ]; }; then
+ printf 'Token file must be a regular file owned by the current user.\n' >&2
+ exit 1
+ fi
+ mkdir -p "$config_dir"
+ chmod 700 "$config_dir"
+ touch "$token_file"
+ chmod 600 "$token_file"
+ vi "$token_file"
+)
```
After saving the token in the editor, create the Secret in the same namespace
-as the agent. The generated Secret goes directly to kubectl, not to your
-terminal or a checked-in manifest. The subshell stops on either pipeline's
+as the agent. This is a provisioning operation that can change cluster state,
+not a diagnostic for a missing reading. Check your current kubectl context and
+intended namespace privately before proceeding. The generated Secret goes
+directly to kubectl, not to your terminal or a checked-in manifest. Recheck the
+credential path before either pipeline; an empty, unreadable or unsafe file
+stops before contacting the cluster. The subshell stops on either pipeline's
failure; do not continue to the agent deployment if it fails:
```bash
(
set -euo pipefail
- test -s "$HOME/.config/pulse/kubernetes-agent-token"
+ umask 077
+ config_dir="$HOME/.config/pulse"
+ token_file="$config_dir/kubernetes-agent-token"
+ if [ -L "$HOME/.config" ] || [ -L "$config_dir" ] || [ -L "$token_file" ]; then
+ printf 'Refusing a symlinked credential path.\n' >&2
+ exit 1
+ fi
+ for directory in "$HOME/.config" "$config_dir"; do
+ if [ ! -d "$directory" ] || [ ! -O "$directory" ]; then
+ printf 'Credential directories must belong to the current user.\n' >&2
+ exit 1
+ fi
+ done
+ if [ ! -f "$token_file" ] || [ ! -O "$token_file" ] || [ ! -r "$token_file" ] || [ ! -s "$token_file" ]; then
+ printf 'Token file must be owned, readable, regular and non-empty.\n' >&2
+ exit 1
+ fi
+ chmod 700 "$config_dir"
+ chmod 600 "$token_file"
kubectl create namespace pulse --dry-run=client -o yaml | \
kubectl apply --server-side --field-manager=pulse-agent-setup -f -
kubectl -n pulse create secret generic pulse-agent-env \
- --from-file=PULSE_TOKEN="$HOME/.config/pulse/kubernetes-agent-token" \
+ --from-file=PULSE_TOKEN="$token_file" \
--dry-run=client -o yaml | \
kubectl apply --server-side --field-manager=pulse-agent-setup -f -
)
@@ -378,6 +423,27 @@ Talos Linux is immutable, so you cannot install the agent via the shell script.
## 4. Troubleshooting
-- **Agent not showing in UI**: Check logs for the DaemonSet pods, for example: `kubectl logs -l app=pulse-agent -n pulse`.
-- **"Permission Denied" on metrics**: Ensure `securityContext.privileged: true` is set or proper capabilities are added.
-- **Connection Refused**: Ensure `PULSE_URL` is correct and reachable from the agent pods.
+Start with the affected pod's existing status and a bounded, locally reviewed
+log excerpt around the original failure. Missing usage, missing inventory and
+a rejected Pulse report are different failures:
+
+| Observation | What to check without widening access |
+| --- | --- |
+| Pulse rejects reporting with HTTP 401/403 | Compare the intended Pulse server, token scopes and cluster identity with the existing configuration. `kubernetes:report` authorises Kubernetes reporting; host reporting also needs `agent:report`. Use the [agent authentication checks](UNIFIED_AGENT.md#agent-lookup-returns-http-401-or-403), not an administrator token or a new installation. |
+| Kubernetes API reports Forbidden | Check the pod's service account and the exact denied API resource against its Role/ClusterRole. Running a pod as root or privileged does not grant Kubernetes API permissions. Do not add `cluster-admin`, Secret reads or `nodes/proxy` merely to diagnose a missing reading. |
+| Inventory appears but CPU/memory usage is absent | Check whether the cluster's `metrics.k8s.io` service and its intended read permissions are available. Pulse can continue with inventory-only reporting when usage collection fails; missing usage is not zero. Host mounts and privileged mode are a separate, deliberate node-telemetry choice, not a repair for API metrics access. |
+| Connection refused or TLS validation fails | Check the existing `PULSE_URL` and network path from the agent pod, not just your browser. A refusal is not an authentication error; retain certificate verification and do not replace a token or expose Pulse to bypass it. |
+
+An applied Secret or running pod is not proof that Pulse accepted a fresh report
+or collected every resource. Keep expected inventory and usage separate when
+checking the ordinary view. Do not reapply the Secret, restart pods, enable
+Debug, change cluster permissions or rerun provisioning just to complete a
+report. A deliberate token rotation is separate maintenance and needs the
+restart described above.
+
+Keep tokens, Secret YAML, kubeconfigs, Helm values, pod environments and full
+logs private. Use the original time, status, API resource and a manually
+redacted error if help is needed; use consistent aliases for cluster, namespace
+and pod names. Do not publish `kubectl get secret -o yaml`, full pod descriptions
+or a broad label-selected log dump. Existing observations or unknowns are
+valid evidence; see [safe evidence collection](TROUBLESHOOTING.md#collect-diagnostics-safely).
diff --git a/frontend-modern/src/features/docs/__tests__/kubernetesSetupDocs.test.ts b/frontend-modern/src/features/docs/__tests__/kubernetesSetupDocs.test.ts
new file mode 100644
index 0000000000..3f60ebb928
--- /dev/null
+++ b/frontend-modern/src/features/docs/__tests__/kubernetesSetupDocs.test.ts
@@ -0,0 +1,82 @@
+import { readFileSync } from 'node:fs';
+import path from 'node:path';
+import { fileURLToPath } from 'node:url';
+import { describe, expect, it } from 'vitest';
+import { renderDocMarkdown } from '../docMarkdown';
+
+const frontendRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../..');
+const repoRoot = path.resolve(frontendRoot, '..');
+const readDoc = (name: string) => readFileSync(path.join(repoRoot, 'docs', `${name}.md`), 'utf8');
+const guide = readDoc('KUBERNETES');
+
+function articleFor(name: string) {
+ const article = document.createElement('article');
+ article.innerHTML = renderDocMarkdown(readDoc(name), name);
+ return article;
+}
+
+describe('Kubernetes credential setup and diagnosis', () => {
+ it('keeps both copied credential recipes intact and distinct from deployment', () => {
+ const article = articleFor('KUBERNETES');
+ const recipes = [...article.querySelectorAll('pre code')].map((code) => code.textContent!);
+ const preparation = recipes.find((text) => text.includes('vi "$token_file"'))!;
+ const provisioning = recipes.find((text) => text.includes('--from-file=PULSE_TOKEN='))!;
+ for (const recipe of [preparation, provisioning]) {
+ expect(recipe).toContain('[ -L "$token_file" ]');
+ expect(recipe).toContain('umask 077');
+ expect(recipe).toContain('chmod 600 "$token_file"');
+ }
+ expect(preparation).toContain('set -eu');
+ expect(provisioning).toContain('set -euo pipefail');
+ expect(provisioning).toContain('[ ! -s "$token_file" ]');
+ const text = article.textContent!.replace(/\s+/g, ' ');
+ expect(text).toContain('Stop if preparation or the editor fails');
+ expect(text).toContain('Existing token contents are preserved');
+ expect(text).toContain('provisioning operation that can change cluster state');
+ expect(text).toContain('not a diagnostic for a missing reading');
+ });
+
+ it('shows four failure paths without promoting pods or tokens for diagnosis', () => {
+ const article = articleFor('KUBERNETES');
+ const heading = article.querySelector('#4-troubleshooting')!;
+ expect(heading).not.toBeNull();
+ let table = heading.nextElementSibling;
+ while (table && table.tagName !== 'TABLE') table = table.nextElementSibling;
+ const rows = [...table!.querySelectorAll('tbody tr')];
+ expect(rows).toHaveLength(4);
+ expect(rows.map((row) => row.firstElementChild!.textContent)).toEqual([
+ 'Pulse rejects reporting with HTTP 401/403',
+ 'Kubernetes API reports Forbidden',
+ 'Inventory appears but CPU/memory usage is absent',
+ 'Connection refused or TLS validation fails',
+ ]);
+ const text = table!.textContent!.replace(/\s+/g, ' ');
+ expect(text).toContain('does not grant Kubernetes API permissions');
+ expect(text).toContain('Do not add cluster-admin');
+ expect(text).toContain('missing usage is not zero');
+ expect(text).toContain('retain certificate verification');
+ expect(article.textContent).not.toContain('Ensure securityContext.privileged: true');
+ });
+
+ it('routes authentication and private evidence to actual destination headings', () => {
+ const article = articleFor('KUBERNETES');
+ for (const [name, anchor] of [
+ ['UNIFIED_AGENT', 'agent-lookup-returns-http-401-or-403'],
+ ['TROUBLESHOOTING', 'collect-diagnostics-safely'],
+ ]) {
+ expect(article.querySelector(`a[href="/docs/${name}#${anchor}"]`)).not.toBeNull();
+ expect(articleFor(name).querySelector(`#${anchor}`)).not.toBeNull();
+ }
+ expect(article.textContent!.replace(/\s+/g, ' ')).toContain(
+ 'Keep tokens, Secret YAML, kubeconfigs, Helm values, pod environments and full logs private',
+ );
+ });
+
+ it('ships the exact canonical guide without changing the optional host profile', () => {
+ expect(readFileSync(path.join(frontendRoot, 'public/docs/KUBERNETES.md'), 'utf8')).toBe(guide);
+ const hostProfile = guide.split('#### Add Host Metrics (Optional)')[1].split('#### RBAC')[0];
+ expect(hostProfile).toContain('privileged: true');
+ expect(hostProfile).toContain('readOnly: true');
+ expect(hostProfile).toContain('PULSE_ENABLE_HOST');
+ });
+});
diff --git a/scripts/tests/test_setup_access_docs.py b/scripts/tests/test_setup_access_docs.py
index 834d49a1df..96be4d1788 100644
--- a/scripts/tests/test_setup_access_docs.py
+++ b/scripts/tests/test_setup_access_docs.py
@@ -94,7 +94,7 @@ class SetupAccessDocsTest(unittest.TestCase):
subprocess.run(["bash", "-n", "-c", block], check=True, capture_output=True)
def test_private_file_preparation_preserves_existing_token(self):
- command = recipe("KUBERNETES", 'vi "$HOME/.config/pulse/kubernetes-agent-token"')
+ command = recipe("KUBERNETES", 'vi "$token_file"')
with tempfile.TemporaryDirectory(prefix="setup docs ") as temporary:
home = Path(temporary)
tools = home / "tools"
@@ -109,13 +109,81 @@ class SetupAccessDocsTest(unittest.TestCase):
token.write_text(TEST_TOKEN + "\n")
token.chmod(0o644)
token.parent.chmod(0o755)
- result = subprocess.run(["bash", "-eu", "-c", command], env=env, capture_output=True, timeout=10)
+ result = subprocess.run(["bash", "-c", command], env=env, capture_output=True, timeout=10)
self.assertEqual(result.returncode, 0, result.stderr.decode())
self.assertEqual(stat.S_IMODE(token.stat().st_mode), 0o600)
self.assertEqual(stat.S_IMODE(token.parent.stat().st_mode), 0o700)
self.assertEqual(token.read_text(), TEST_TOKEN + "\n" if existing else "")
self.assertNotIn(TEST_TOKEN.encode(), result.stdout + result.stderr)
+ def test_unsafe_paths_stop_before_editor_or_cluster_contact(self):
+ # Execute the exact copied blocks, without implicit caller errexit.
+ # A pre-existing linked file or parent must not be chmodded/read/written.
+ for needle in ('vi "$token_file"', '--from-file=PULSE_TOKEN='):
+ command = recipe("KUBERNETES", needle)
+ for placement in (".config", ".config/pulse", ".config/pulse/kubernetes-agent-token"):
+ for kind in ("symlink", "dangling-symlink", "fifo", "directory", "regular-parent"):
+ token_path = placement.endswith("kubernetes-agent-token")
+ if (kind == "directory" and not token_path) or (kind == "regular-parent" and token_path):
+ continue
+ with self.subTest(recipe=needle, path=placement, kind=kind), tempfile.TemporaryDirectory() as temporary:
+ home = Path(temporary)
+ path = home / placement
+ path.parent.mkdir(parents=True, exist_ok=True)
+ outside = home / "untouched"
+ outside.mkdir(mode=0o755)
+ outside.chmod(0o755)
+ witness = outside / "kubernetes-agent-token"
+ witness.write_text(TEST_TOKEN)
+ witness.chmod(0o644)
+ if kind == "symlink":
+ path.symlink_to(witness if token_path else outside)
+ elif kind == "dangling-symlink":
+ path.symlink_to(home / "must-not-be-created")
+ elif kind == "fifo":
+ os.mkfifo(path)
+ elif kind == "directory":
+ path.mkdir()
+ else:
+ path.write_text("not a directory")
+ tools = home / "tools"
+ tools.mkdir()
+ receipt = home / "unsafe-operation"
+ for name in ("vi", "kubectl"):
+ tool = tools / name
+ tool.write_text('#!/bin/sh\nprintf called >> "$OPERATION_RECEIPT"\nexit 23\n')
+ tool.chmod(0o700)
+ env = {**os.environ, "HOME": str(home), "PATH": f"{tools}:{os.environ['PATH']}",
+ "OPERATION_RECEIPT": str(receipt)}
+ result = subprocess.run(["bash", "-c", command], env=env, capture_output=True, timeout=10)
+ self.assertNotEqual(result.returncode, 0)
+ self.assertFalse(receipt.exists(), "unsafe path must stop before editor or kubectl")
+ self.assertEqual(witness.read_text(), TEST_TOKEN)
+ self.assertEqual(stat.S_IMODE(witness.stat().st_mode), 0o644)
+ self.assertEqual(stat.S_IMODE(outside.stat().st_mode), 0o755)
+ self.assertFalse((home / "must-not-be-created").exists())
+ self.assertNotIn(TEST_TOKEN.encode(), result.stdout + result.stderr)
+
+ def test_preparation_failures_do_not_continue_to_editor(self):
+ for failed in ("mkdir", "chmod", "touch", "vi"):
+ with self.subTest(failed=failed), tempfile.TemporaryDirectory() as temporary:
+ home = Path(temporary)
+ tools = home / "tools"
+ tools.mkdir()
+ receipt = home / "editor-called"
+ for name in (failed, "vi"):
+ tool = tools / name
+ tool.write_text('#!/bin/sh\n' +
+ ('printf called > "$EDITOR_RECEIPT"\n' if name == "vi" else '') +
+ 'exit 23\n')
+ tool.chmod(0o700)
+ env = {**os.environ, "HOME": str(home), "PATH": f"{tools}:{os.environ['PATH']}",
+ "EDITOR_RECEIPT": str(receipt)}
+ result = subprocess.run(["bash", "-c", recipe("KUBERNETES", 'vi "$token_file"')],
+ env=env, capture_output=True, timeout=10)
+ self.assertEqual(result.returncode, 23)
+ self.assertEqual(receipt.exists(), failed == "vi")
+
def run_secret(self, home: Path, fail: str = "", empty: bool = False):
private = home / ".config/pulse"
private.mkdir(parents=True, mode=0o700)
@@ -179,6 +247,23 @@ class SetupAccessDocsTest(unittest.TestCase):
"restarting the agent pods", "forcing the conflict"):
self.assertIn(boundary, content)
+ def test_diagnosis_distinguishes_reporting_rbac_and_usage_without_privilege_escalation(self):
+ text = " ".join(guide("KUBERNETES").split("## 4. Troubleshooting", 1)[1].split())
+ for boundary in ("existing status", "bounded, locally reviewed", "HTTP 401/403", "exact denied API resource",
+ "does not grant Kubernetes API permissions", "Do not add `cluster-admin`",
+ "`metrics.k8s.io`", "inventory-only", "missing usage is not zero",
+ "separate, deliberate node-telemetry choice", "retain certificate verification",
+ "not proof that Pulse accepted a fresh report", "Do not reapply the Secret",
+ "enable Debug", "kubeconfigs", "full logs private", "redacted error",
+ "consistent aliases", "unknowns", "TROUBLESHOOTING.md#collect-diagnostics-safely"):
+ self.assertIn(boundary, text)
+ self.assertNotIn("Ensure `securityContext.privileged: true`", text)
+ self.assertNotIn("kubectl logs -l", text)
+ source = (ROOT / "internal/kubernetesagent/agent.go").read_text()
+ for boundary in ('"/apis/metrics.k8s.io/v1beta1/nodes"', '"/apis/metrics.k8s.io/v1beta1/pods"',
+ "continuing with inventory-only report", "kubernetes access forbidden (RBAC)"):
+ self.assertIn(boundary, source)
+
def test_cloud_uses_existing_private_file_installation_not_server_installer(self):
content = " ".join(guide("CLOUD").split())
for boundary in ("UNIFIED_AGENT.md#private-file-installation-linux-macos-and-nas", "--token-file",