Polaris est une plateforme de validation Kubernetes développée par Fairwinds qui adopte une approche double : validation statique des manifests dans les pipelines CI/CD (comme KubeLinter), et monitoring continu des workloads déjà déployés via un dashboard web. Il vérifie plus de 30 best practices couvrant la sécurité (securityContext, capabilities, hostNetwork), l'efficiency (resource requests/limits) et la reliability (probes, réplication). Polaris peut aussi fonctionner en mode admission webhook pour bloquer les déploiements non conformes.
Différence avec KubeLinter : Polaris offre un dashboard web avec scoring et tendances dans le temps, ce qui le rend plus adapté aux équipes qui veulent visualiser la posture de sécurité d'un cluster en production.
Informations essentielles
Origine : Fairwinds · Licence : Apache 2.0 · Architectures : x86_64, ARM64
Liens : Site officiel · Documentation · GitHub · Releases
Support : Projet actif maintenu par Fairwinds. Version open source + Fairwinds Insights (SaaS commercial).
Stack par défaut
| Composant | Valeur |
|---|---|
| Modes | CLI (static), Dashboard web (runtime), Admission Webhook (enforcement) |
| Checks built-in | 30+ règles (sécurité, efficiency, reliability) |
| Severity | danger, warning, ignore |
| Formats CLI | Texte, JSON, YAML, Score |
| Dashboard | Interface web déployée dans le cluster |
Modes de fonctionnement
| Mode | Description | Usage |
|---|---|---|
| CLI audit | Scan statique des manifests sans cluster | CI/CD, validation locale |
| Dashboard | Déployé dans le cluster, scan continu des workloads | Monitoring ongoing |
| Admission webhook | Bloque les déploiements non conformes | Enforcement en production |
Prérequis
| Ressource | Valeur |
|---|---|
| CLI | Linux, macOS, Windows (binaire autonome) |
| Dashboard/Webhook | Kubernetes 1.21+, Helm 3.x |
Installation
CLI (audit statique)
# Linux
curl -Lo polaris https://github.com/FairwindsOps/polaris/releases/latest/download/polaris_linux_amd64
chmod +x polaris && sudo mv polaris /usr/local/bin/
# macOS
brew install fairwinds-ops/tap/polaris
# Vérifier
polaris version
Dashboard (monitoring continu en cluster)
helm repo add fairwinds-stable https://charts.fairwinds.com/stable
helm repo update
helm install polaris fairwinds-stable/polaris \
--namespace polaris --create-namespace
# Accéder au dashboard
kubectl port-forward svc/polaris-dashboard 8080:80 -n polaris
# Ouvrir http://localhost:8080
Admission webhook (optionnel - enforcement)
helm install polaris fairwinds-stable/polaris \
--namespace polaris --create-namespace \
--set webhook.enable=true \
--set dashboard.enable=true
Vérification de l'installation
# 1. Version CLI
polaris version
# 2. Test sur un manifest (CLI)
cat > test-deploy.yaml <<EOF
apiVersion: apps/v1
kind: Deployment
metadata:
name: test
spec:
replicas: 1
selector:
matchLabels: {app: test}
template:
metadata:
labels: {app: test}
spec:
containers:
- name: app
image: nginx
EOF
polaris audit --audit-path test-deploy.yaml --format score
# Doit afficher un score (ex: 62/100) et la liste des problèmes
rm test-deploy.yaml
# 3. Audit du cluster complet (si kubeconfig configuré)
polaris audit --score
# Score global du cluster
# 4. Vérifier le dashboard (si déployé)
kubectl get pods -n polaris
# polaris-* doit être Running (1/1)
# 5. Webhook enregistré (si activé)
kubectl get validatingwebhookconfigurations | grep polaris
Pièges courants
| Symptôme | Cause | Correction |
|---|---|---|
| Webhook bloque des déploiements légitimes | danger checks trop stricts | Passer en warning ou ajouter des exemptions |
| Dashboard vide | Aucun workload dans les namespaces surveillés | Vérifier la config namespace dans le Helm values |
| Score inattendu bas | Checks couvrant aussi l'efficiency (pas juste sécurité) | Affiner la config pour exclure les checks non pertinents |
Utilisation en CLI
Audit d'un répertoire
# Audit complet avec score
polaris audit --audit-path ./k8s/ --format score
# Sortie JSON détaillée
polaris audit --audit-path ./k8s/ --format json > polaris-report.json
# Sortie YAML
polaris audit --audit-path ./k8s/ --format yaml
# Avec seuil de score (fail si < 80)
polaris audit --audit-path ./k8s/ --set-exit-code-on-score 80
Audit d'un cluster live
# Audit du cluster courant
polaris audit --score
# Par namespace
polaris audit --namespace production --format json
# Audit d'une ressource spécifique
polaris audit --resource deployment/my-app -n production
Avec Helm
helm template my-release ./my-chart | polaris audit --audit-path -
Configuration
Fichier de configuration Polaris
# polaris-config.yaml
checks:
# Sécurité - danger par défaut
privilegeEscalationAllowed: danger
runAsRootAllowed: danger
runAsPrivileged: danger
notReadOnlyRootFilesystem: warning
# Modifier la sévérité d'un check
livenessProbeMissing: warning # danger par défaut
# Désactiver un check
readinessProbeMissing: ignore
exemptions:
# Exempter un namespace entier
- namespace: kube-system
rules:
- privilegeEscalationAllowed
- hostNetworkSet
# Exempter un workload spécifique
- controllerNames:
- my-privileged-app
rules:
- runAsPrivileged
polaris audit --audit-path ./k8s/ \
--config polaris-config.yaml \
--format score
Intégration CI/CD
GitHub Actions
- name: Polaris audit
run: |
polaris audit \
--audit-path ./k8s/ \
--set-exit-code-on-score 75 \
--format score
Mise à jour
# CLI
curl -Lo polaris https://github.com/FairwindsOps/polaris/releases/latest/download/polaris_linux_amd64
chmod +x polaris && sudo mv polaris /usr/local/bin/
# Dashboard
helm repo update
helm upgrade polaris fairwinds-stable/polaris \
--namespace polaris \
--reuse-values
Troubleshooting
# Logs du dashboard
kubectl logs -n polaris -l app=polaris --tail=100
# Vérifier la configuration active
kubectl get configmap -n polaris polaris -o yaml
# Audit verbose
polaris audit --audit-path ./k8s/ --format json | jq '.Results[] | select(.PodResult.PodResult != null)'
Commandes utiles
polaris audit --audit-path <dir> # Audit CLI statique
polaris audit --score # Audit du cluster + score global
polaris audit --format json # Sortie JSON détaillée
polaris audit --set-exit-code-on-score 80 # Pipeline gate (fail si score < 80)
polaris audit --namespace <ns> # Limiter à un namespace
polaris audit --config polaris.yaml # Config personnalisée
Ressources
- Documentation officielle : https://polaris.docs.fairwinds.com/
- GitHub : https://github.com/FairwindsOps/polaris
- Releases : https://github.com/FairwindsOps/polaris/releases
- Fairwinds Insights (SaaS) : https://www.fairwinds.com/insights