Nais logo

Nais

Organization
navikt
nais

Nais-deployment, GCP-ressurser, pod-lifecycle og feilsøking på plattformen

Overview

Publishernavikt
Repositorycopilot
Skill namenais
Stars
60
Forks
16
Bundled files
1
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 1 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by navikt on GitHub. Read the source before you install it.

Installation

Install the Nais AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/navikt/copilot/tree/main/skills/nais
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/navikt/copilot.git /tmp/copilot
mkdir -p .claude/skills
cp -r /tmp/copilot/skills/nais .claude/skills/nais
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Nais in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Nais on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Nais is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

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

bash
# 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:80

Nais Manifest Structure

Every Nais application requires:

yaml
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: 512Mi

Pod Lifecycle and Graceful Shutdown

When Kubernetes terminates a pod on NAIS:

  1. K8s notifies load balancer and pod simultaneously — LB starts draining connections
  2. NAIS preStop hook runs sleep 5 — gives LB time to stop routing new traffic
  3. App receives SIGTERM — no new requests arrive from LB
  4. App drains in-flight requests and exits
  5. 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 false on SIGTERM — unnecessary
  • ❌ terminationGracePeriodSeconds too low — must be > 5s (preStop) + drain time
  • ❌ Adding a preStop hook with extra sleep — NAIS already injects sleep 5

Common Tasks

Adding PostgreSQL Database

yaml
gcp:
  sqlInstances:
    - type: POSTGRES_18
      databases:
        - name: myapp-db
          envVarPrefix: DB

Application receives: DB_HOST, DB_PORT, DB_DATABASE, DB_USERNAME, DB_PASSWORD

Configuring Kafka

yaml
kafka:
  pool: nav-dev # or nav-prod

Entra ID Authentication

yaml
azure:
  application:
    enabled: true
    tenant: nav.no

TokenX for Service-to-Service

yaml
tokenx:
  enabled: true

accessPolicy:
  inbound:
    rules:
      - application: calling-app
        namespace: calling-namespace
  outbound:
    rules:
      - application: downstream-app
        namespace: downstream-namespace
    external:
      - host: api.example.com
      - host: db.example.com
        ports:
          - port: 5432

Egress to hosts outside the cluster is blocked unless listed in outbound.external or on the Nais default allow-list (Google APIs, Microsoft login/Graph, Aiven). Use host (no https://) or ipv4, not both. Add ports for protocols other than HTTPS.

Ingress Configuration

yaml
ingresses:
  - https://myapp.intern.dev.nav.no # Internal dev
  - https://myapp.dev.nav.no        # External dev

Scaling

yaml
replicas:
  min: 2
  max: 4
  cpuThresholdPercentage: 80

Resource Recommendations

SizeCPU requestMemory requestMemory limit
Small50m256Mi512Mi
Medium100m512Mi1Gi
Large200m1Gi2Gi

Never set CPU limits — causes throttling. Use requests only.

Troubleshooting

Pod Not Starting

  1. Check logs: kubectl logs -n namespace pod-name
  2. Check events: kubectl describe pod -n namespace pod-name
  3. Verify health endpoints return 200 OK
  4. Check resource limits (memory/CPU)

Database Connection Issues

  1. Verify database exists in GCP Console
  2. Check environment variables are injected
  3. Verify Cloud SQL Proxy is running
  4. Check network policies allow connection

Kafka Connection Issues

  1. Verify kafka.pool is correct (nav-dev/nav-prod)
  2. Check Kafka credentials are injected
  3. Verify SSL configuration
  4. Check topic exists and permissions are correct

Deployment Workflow

  1. Create .nais/app.yaml manifest
  2. Implement health endpoints (/isalive, /isready, /metrics)
  3. Test locally with Docker
  4. Deploy to dev environment
  5. Verify metrics in Grafana
  6. Check logs in Loki
  7. Create prod manifest (.nais/app-prod.yaml)
  8. Deploy to production

Gotchas

  • accessPolicy defaults 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 accessPolicy for network traffic
  • Use environment-specific manifests
  • Run kubectl get app <name> -o yaml to 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

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Nais AI skill do?

Nais-deployment, GCP-ressurser, pod-lifecycle og feilsøking på plattformen

Why use Nais on TypingMind?

Because you install it once and use it with any model. Nais is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Nais in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/navikt/copilot/tree/main/skills/nais. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Nais?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Nais?

As many as you like. As long as a model supports skills, you can use Nais with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Nais AI skill free?

Yes. It is published on GitHub by navikt under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇