Skip to content

Defining your application

You're now in a team, you've got access to the clusters. Assuming you have an application you want to run, here's how to define your application in NAIS.

Packaging

Kubernetes orchestrates containers. In order to deploy to NAIS, your application must thus be packaged into a container image.

This is usually done with Docker, so the following examples will showcase the use of Docker. You will have to create your own Dockerfile as the file is dependent on your application's technology stack and requirements.

Configuration

Your application needs an associated manifest (typically referred to as a nais.yaml) to run on NAIS. See the NAIS documentation for a more thorough introduction to this manifest.

Example nais.yaml
apiVersion: "nais.io/v1alpha1"
kind: "Application"
metadata:
  name: my-app
  namespace: my-team
  labels:
    team: my-team
spec:
    image: europe-north1-docker.pkg.dev/nais-io/nais/images/testapp:sha-8c52673
    ingresses:
    - my-app.our-domain.com
    port: 8080
    prometheus:
      enabled: true
      path: /metrics
    replicas:
      min: 2
      max: 4
    resources:
      requests:
        cpu: 50m
        memory: 32Mi
    accessPolicy:
      inbound:
        rules:
        - application: another-app       # allows access from another-app in same namespace
      outbound:
        rules:
        - application: some-app          # allows access to some-app in some-ns namespace
          namespace: some-ns
        external:
        - host: some-api-provider.com    # allows access to external endpoint

Last update: November 22, 2022
Created: November 22, 2022