nais
Skill54 starsChanged 3 months agoMITView on GitHub
Nais-deployment, GCP-ressurser, pod-lifecycle og feilsøking på plattformen
In this repository35 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- ai-news-researchSkill
- aksel-builderSkill
- aksel-spacingSkill
- api-designSkill
- conventional-commitSkill
- deliberate-ai-useSkill
- flyway-migrationSkill
- jackson-3-migrationSkill
- java-to-kotlinSkill
- kafkaSkill
- klarsprakSkill
- kotlin-app-configSkill
- ktor-scaffoldSkill
- nav-architecture-reviewSkill
- nav-authSkill
- nav-deep-interviewSkill
- nav-dekoratorenSkill
- nav-planSkill
- nav-troubleshootSkill
- observability-debuggingSkill
- observability-setupSkill
- playwright-testingSkill
- postgresql-reviewSkill
- readme-reviewSkill
- rust-developmentSkill
- security-owaspSkill
- security-reviewSkill
- spring-boot-scaffoldSkill
- terse-modeSkill
- threat-modelSkill
- tokenx-authSkill
- web-design-reviewerSkill
- workstation-securitySkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
17 rules. About 0 are common, 14 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈14
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 47
Every Nais application requires:
- Distinctive: line 85
When Kubernetes terminates a pod on NAIS:
- Distinctive: line 181
Verify health endpoints return 200 OK
- Distinctive: line 182
Check resource limits (memory/CPU)
- Distinctive: line 186
Verify database exists in GCP Console
- Distinctive: line 187
Check environment variables are injected
- Distinctive: line 188
Verify Cloud SQL Proxy is running
- Distinctive: line 189
Check network policies allow connection
- Very specific: line 193
Verify kafka.pool is correct (nav-dev/nav-prod)
- Distinctive: line 194
Check Kafka credentials are injected
- Distinctive: line 196
Check topic exists and permissions are correct
- Distinctive: line 202
Test locally with Docker
- Distinctive: line 204
Verify metrics in Grafana
- Distinctive: line 205
Check logs in Loki
- Very specific: line 206
Create prod manifest (.nais/app-prod.yaml)
- Distinctive: line 212
Don't set CPU limits — only requests (limits cause throttling)
- Very specific: line 226
Run kubectl get app <name> -o yaml to verify deployment
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Nais Platform Skill
Patterns and procedures for deploying, configuring, and troubleshooting applications on Nais (Kubernetes on GCP).
When to Use
- Creating or modifying Nais manifests
- Adding GCP resources (PostgreSQL, Kafka, buckets)
- Configuring access policies and ingress
- Troubleshooting pod startup failures or crashes
- Understanding pod lifecycle and graceful shutdown
Commands
# Check pod status
kubectl get pods -n <namespace> -l app=<app-name>
# View pod logs (add -f to follow)
kubectl logs -n <namespace> -l app=<app-name> --tail=100 -f
# Describe pod (events, errors)
kubectl describe pod -n <namespace> <pod-name>
# View Nais app status
kubectl get app -n <namespace> <app-name> -o yaml
# Restart deployment (rolling)
kubectl rollout restart deployment/<app-name> -n <namespace>
# Port-forward for local debugging
kubectl port-forward -n <namespace> svc/<app-name> 8080:80Nais Manifest Structure
Every Nais application requires:
apiVersion: nais.io/v1alpha1
kind: Application
metadata:
name: app-name
namespace: team-namespace
labels:
team: team-namespace
spec:
image: {{ image }} # Replaced by CI/CD
port: 8080
# Observability (required)
prometheus:
enabled: true
path: /metrics
# Health checks (required)
liveness:
path: /isalive
initialDelay: 5
readiness:
path: /isready
initialDelay: 5
# Resources (required)
resources:
requests:
cpu: 50m
memory: 256Mi
limits:
memory: 512MiPod Lifecycle and Graceful Shutdown
When Kubernetes terminates a pod on NAIS:
- K8s notifies load balancer and pod simultaneously — LB starts draining connections
- NAIS preStop hook runs
sleep 5— gives LB time to stop routing new traffic - App receives SIGTERM — no new requests arrive from LB
- App drains in-flight requests and exits
- After
terminationGracePeriodSeconds(default 30s): SIGKILL
Key insight: Readiness probes are NOT involved in shutdown. Your app just needs to handle SIGTERM, finish in-flight requests, and exit cleanly.
Common anti-patterns:
- ❌ Setting readiness to
falseon SIGTERM — unnecessary - ❌
terminationGracePeriodSecondstoo low — must be > 5s (preStop) + drain time - ❌ Adding a
preStophook with extra sleep — NAIS already injectssleep 5
Common Tasks
Adding PostgreSQL Database
gcp:
sqlInstances:
- type: POSTGRES_15
databases:
- name: myapp-db
envVarPrefix: DBApplication receives: DB_HOST, DB_PORT, DB_DATABASE, DB_USERNAME, DB_PASSWORD
Configuring Kafka
kafka:
pool: nav-dev # or nav-prodAzure AD Authentication
azure:
application:
enabled: true
tenant: nav.noTokenX for Service-to-Service
tokenx:
enabled: true
accessPolicy:
inbound:
rules:
- application: calling-app
namespace: calling-namespace
outbound:
rules:
- application: downstream-app
namespace: downstream-namespaceIngress Configuration
ingresses:
- https://myapp.intern.dev.nav.no # Internal dev
- https://myapp.dev.nav.no # External devScaling
replicas:
min: 2
max: 4
cpuThresholdPercentage: 80Resource Recommendations
| Size | CPU request | Memory request | Memory limit |
| Small | 50m | 256Mi | 512Mi |
| Medium | 100m | 512Mi | 1Gi |
| Large | 200m | 1Gi | 2Gi |
Never set CPU limits — causes throttling. Use requests only.
Troubleshooting
Pod Not Starting
- Check logs:
kubectl logs -n namespace pod-name - Check events:
kubectl describe pod -n namespace pod-name - Verify health endpoints return 200 OK
- Check resource limits (memory/CPU)
Database Connection Issues
- Verify database exists in GCP Console
- Check environment variables are injected
- Verify Cloud SQL Proxy is running
- Check network policies allow connection
Kafka Connection Issues
- Verify
kafka.poolis correct (nav-dev/nav-prod) - Check Kafka credentials are injected
- Verify SSL configuration
- Check topic exists and permissions are correct
Deployment Workflow
- Create
.nais/app.yamlmanifest - Implement health endpoints (
/isalive,/isready,/metrics) - Test locally with Docker
- Deploy to dev environment
- Verify metrics in Grafana
- Check logs in Loki
- Create prod manifest (
.nais/app-prod.yaml) - Deploy to production
Gotchas
accessPolicydefaults to deny-all — you must explicitly allow traffic- Don't set CPU limits — only requests (limits cause throttling)
- Memory limits are mandatory — missing limits cause OOM cluster issues
- NAIS injects
preStop: sleep 5— don't add your own {{ image }}in manifest is replaced by CI/CD — don't hardcode images- Environment-specific manifests (
app-dev.yaml,app-prod.yaml) are the norm
Boundaries
✅ Always
- Include liveness, readiness, and metrics endpoints
- Set memory limits
- Define explicit
accessPolicyfor network traffic - Use environment-specific manifests
- Run
kubectl get app <name> -o yamlto verify deployment
⚠️ Ask First
- Changing production resource limits or replicas
- Adding new GCP resources (cost implications)
- Modifying network policies (
accessPolicy) - Changing Kafka topic configurations
- Adding new ingress domains
🚫 Never
- Store secrets in Git (use Azure Key Vault or Kubernetes secrets)
- Deploy directly without CI/CD pipeline
- Skip health endpoints
- Set CPU limits
- Remove memory limits
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

