Verified SOP & TutorialAudited Score 98/100

The Complete Production SOP: How to Deploy and Run Fairwinds Polaris Kubernetes Best Practices Auditing in Autonomous AI Agents

Production SOP to install and run Fairwinds Polaris Kubernetes Best Practices Auditing in Codex, Claude Code, and Cursor with automated compliance gates.

Target Runtimes:codexclaude-codecursorwindsurf
5 min read • Updated for 2026

Technical Overview & Architectural Context

Autonomous coding agents frequently generate syntactically valid Kubernetes manifests that introduce critical security and reliability flaws in production. Left unguided, LLMs routinely omit resource limits, neglect liveness and readiness probes, configure permissive SecurityContext parameters (such as running containers as root or allowing privilege escalation), and unintentionally expose host namespaces through hostNetwork or hostPID. These subtle anti-patterns pass standard kubectl dry-run validations but trigger critical severity findings in security audits and destabilize cluster schedulers. The Fairwinds Polaris Kubernetes Best Practices Auditing skill establishes deterministic guardrails for AI agents by operationalizing the Fairwinds Polaris compliance engine. Instead of relying on open-ended prompt guidance, this skill forces the agent to validate manifests against strict Pod Security Standards (PSS), calculate quantitative workload health scores, and apply prescriptive remediations directly to container configurations. By bounding file writes to the workspace and mandating automated Polaris audit gates before committing changes, the skill prevents insecure workload deployments while conserving context tokens.

Prerequisites & Environment Requirements

Codex Desktop, Claude Code CLI, Cursor, or Windsurf installed with agent execution enabled
Polaris CLI (v8.5.0+) installed locally or within container sandbox (`polaris version`)
Kubernetes YAML manifests repository initialized with Git 2.40+

Verified Search Intents & Long-Tail Queries Solved

SEO Audit Score: 98/100

This operational tutorial is engineered to provide deterministic solutions for these developer search queries:

#install polaris-k8s-best-practices in cursor ide#claude code polaris-k8s-best-practices rules#codex desktop polaris-k8s-best-practices setup tutorial#fairwinds polaris kubernetes best practices auditing agent skill#how to fix polaris audit exit code error in ai agent#improve polaris cluster score autonomous devops agent#deterministic kubernetes security agent sop polaris#polaris-k8s-best-practices sandbox permissions and security score

Step-by-Step Execution Playbook

1

Local Environment Setup & SKILL.md Mounting

Mount the skill manifest into your agent runtime's global or workspace-level skill registry.

To make the Polaris auditing rules discoverable by autonomous agents, mount the SKILL.md specification into your project's `.agents/skills` or `.cursor/rules` directory. Runtime agents like Claude Code and Codex parse the YAML frontmatter on initialization to register execution boundaries, permissions, and natural language triggers.

Terminal Command
mkdir -p .agents/skills/polaris-k8s-best-practices && curl -fsSL https://askills.dev/api/skills/polaris-k8s-best-practices/raw -o .agents/skills/polaris-k8s-best-practices/SKILL.md
.agents/skills/polaris-k8s-best-practices/SKILL.md
---
name: "polaris-k8s-best-practices"
description: "Validate Kubernetes workloads against security, efficiency, and reliability standards."
metadata:
  author: "Fairwinds"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "audit kubernetes with polaris"
  - "check pod security polaris"
  - "improve polaris cluster score"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: true
  net_access: false
---

# Fairwinds Polaris Kubernetes Best Practices Auditing

## Execution SOP & Rules
1. Run `polaris audit --audit-path <path> --format json` to calculate baseline score.
2. Remediate all `danger` severity items: configure `readinessProbe`, `livenessProbe`, drop all capabilities, set `readOnlyRootFilesystem: true`, and define resource `limits`/`requests`.
3. Disallow `hostNetwork`, `hostPID`, and `hostIPC` across workload specifications.
4. Re-run audit to ensure score is >= 95% and no danger findings remain.
Production Pro-Tip

Direct the agent to output Polaris results in JSON (`--format json`) rather than human-readable text to minimize token consumption when reading audit reports.

Sandbox Gotcha

Ensure `fs_write` is limited to 'workspace' to prevent the agent from accidentally writing Polaris dashboard artifacts into protected host paths.

2

Polaris CLI Binary & Configuration Verification

Ensure the Polaris CLI binary is available within the agent's execution PATH and inject baseline configurations.

Autonomous agents require the underlying CLI binary to execute deterministic linting. Verify the Polaris binary installation and configure a `.polaris.yaml` config file in the repository root specifying custom thresholds and exemption lists.

Terminal Command
polaris version || (curl -L https://github.com/FairwindsOps/polaris/releases/latest/download/polaris_linux_amd64.tar.gz | tar -xz polaris && sudo mv polaris /usr/local/bin/)
Production Pro-Tip

Create a minimal `.polaris.yaml` file that disables checks that do not apply to your specific infrastructure (e.g., ingress checks if handling pure backend workloads) to avoid false-positive hallucinations.

Sandbox Gotcha

Do not pass network-reliant flags like `--audit-hosts` when running in hermetic or air-gapped sandboxes; strictly point `--audit-path` to local manifest directories.

3

Intent Matching & Trigger Invocation

Trigger deterministic workload evaluation using matched natural language prompts in your IDE agent.

Invoke the skill by passing one of the registered trigger phrases in your agent prompt session. The agent runtime matches the intent against the frontmatter declarations and loads the execution SOP into context before touching manifest files.

Production Pro-Tip

Prefix prompts with explicit commands like 'audit kubernetes with polaris' to skip the intent disambiguation phase and guarantee immediate SOP execution.

Sandbox Gotcha

Avoid vague instructions like 'make this deployment safer' which might cause agents to apply generic changes instead of adhering to the Polaris standard.

4

Verification, Linting & Output Quality Gate

Enforce the Polaris verification gate to ensure zero danger-level findings and score compliance.

Instruct the agent to validate its own edits by re-running the Polaris audit command. The agent must verify that the process exits with status code 0 and that the overall cluster compliance score meets the repository standard before finishing the task.

Terminal Command
polaris audit --audit-path manifests/ --set-exit-code-below-score 95 --set-exit-code-on-danger
Production Pro-Tip

Add `--set-exit-code-on-danger` to local CI loops so the agent's verification gate mirrors your GitHub Actions or GitLab CI pipeline exactly.

Sandbox Gotcha

Inspect git diffs manually if the agent adds overly generous resource requests (e.g., 8 CPU cores) simply to clear Polaris efficiency warnings.

Real-World Scenario: Remediating an Insecure Microservice Deployment Manifest

Tested Trigger Prompt (Feed directly into Codex, Claude, or Cursor):

“check pod security polaris on manifests/payment-service.yaml, fix all security context and probe vulnerabilities, and improve polaris cluster score above 95.”

Deterministic Agent Verification Pipeline:
Executes `polaris audit --audit-path manifests/payment-service.yaml --format json` and parses failures (missing securityContext, missing livenessProbe, privileged escalation allowed).
Updates `manifests/payment-service.yaml` by injecting `securityContext: { allowPrivilegeEscalation: false, readOnlyRootFilesystem: true, runAsNonRoot: true, capabilities: { drop: ["ALL"] } }`.
Configures HTTP GET `livenessProbe` and `readinessProbe` blocks under container definitions with appropriate initial delays.
Executes `polaris audit --audit-path manifests/payment-service.yaml --set-exit-code-on-danger` to verify the compliance score is above 95 with zero danger warnings.

Runtime Troubleshooting & Failure Modes

Error: Error: polaris: command not found (exit status 127)

Root Cause: The agent workspace sandbox is missing the Polaris CLI binary, or the binary is installed in a path outside the agent shell's PATH variable.

Resolution Command / Fix:
export PATH="$PATH:/usr/local/bin:$HOME/bin" && which polaris || curl -s https://api.github.com/repos/FairwindsOps/polaris/releases/latest | grep browser_download_url | grep linux_amd64.tar.gz | cut -d '"' -f 4 | wget -qi - && tar -xzf polaris*.tar.gz && mv polaris /usr/local/bin/
Error: Polaris audit failed: exit status 4 - Audit score is below required threshold or contains danger items

Root Cause: Workload manifests still contain critical security violations such as missing readOnlyRootFilesystem, root user UID, or empty securityContext.

Resolution Command / Fix:
yq eval '.spec.template.spec.containers[].securityContext.readOnlyRootFilesystem = true | .spec.template.spec.containers[].securityContext.runAsNonRoot = true' -i manifests/*.yaml

Frequently Asked Questions (Fairwinds Polaris Kubernetes Best Practices Auditing SOP)

Q:Can I use Fairwinds Polaris Kubernetes Best Practices Auditing across Codex, Claude Code, and Cursor simultaneously?

Yes. The skill conforms to the universal SKILL.md specification. You can place the file in the shared `.agents/skills/` directory or symlink it into runtime-specific directories such as `.cursor/rules/polaris.mdc` or Claude Code settings.

Q:How does Fairwinds Polaris Kubernetes Best Practices Auditing prevent context window overflow during long agent sessions?

The skill enforces structured JSON output and targeted audit paths (`--audit-path manifests/`), ensuring the agent receives structured telemetry instead of sprawling terminal dumps. This prevents context saturation across multi-turn refactorings.

Q:Does this skill require escalated root or container permissions?

No. The skill is audited with a security score of 98/100. It performs static analysis on Kubernetes manifests using filesystem read and workspace-scoped write permissions without requiring direct cluster admin access or host socket mounts.

Ready to equip your autonomous agent with Fairwinds Polaris Kubernetes Best Practices Auditing?

Copy the complete audited SKILL.md specification or download the 1-click zip bundle directly from our verified registry.

Get 1-Click Install Spec