Skip to content

Create job

This how-to guide will show you how to create a NAIS manifest for your job.

Setup

Inside your job repository, create a .nais-folder.

cd <MY-JOB>
mkdir .nais

Create a file called job.yaml in the .nais-folder.

touch .nais/job.yaml

Define your job

Below is a basic example of an job manifest.

Add the following content to the file, and insert the appropriate values in the placeholders on the highlighted lines:

.nais/app.yaml
apiVersion: nais.io/v1
kind: Naisjob
metadata:
  labels:
    team: <MY-TEAM>
  name: <MY-JOB>
  namespace: <MY-TEAM>
spec:
  schedule: "0 * * * *" # Runs every hour
  image: {{image}} # Placeholder variable to be replaced by the CI/CD pipeline
  resources:
    requests:
      cpu: 200m
      memory: 128Mi

This job manifest will run your code every hour. If you want to run your job only once, you can remove the schedule field.

🎯 Build and deploy your job to NAIS.

📚 Job spec reference.

📚 Complete job example.