Skip to content
Hands-on IT IT Drills

Day 10: Renovate as a service

Goal: Renovate runs as a Kubernetes CronJob in the kind cluster against Forgejo and opens PRs without your laptop terminal being involved. · Duration: approx. 120 min · Prerequisite: Day 9

Briefing

  • So far you have started Renovate by hand. In operations, a scheduler starts the run: a CronJob, a CI pipeline or an Actions workflow.
  • The global config from Day 9 moves into a ConfigMap as config.js. The token comes from a Secret and never appears in the YAML.
  • Every run starts in a fresh pod. Whatever should survive, such as the repository cache, needs a volume.
  • Forgejo stays in Docker. You attach the container to the Docker network kind, and then the pods reach it as http://forgejo:3000.
 kind cluster "renovate-lab"                     Docker network "kind"
 ┌─────────────────────────────────────────┐     ┌──────────────────────────┐
 │ ns renovate                             │     │ Container "forgejo"      │
 │  CronJob renovate ──► Job ──► Pod       │ ──► │  http://forgejo:3000     │
 │   ConfigMap renovate-config (config.js) │ API │  (Host: 127.0.0.1:3000)  │
 │   Secret    renovate-env (Token)        │ git │                          │
 │   PVC       renovate-cache              │     └──────────────────────────┘
 └─────────────────────────────────────────┘

Drill 1: Cluster and network

A fresh state for shop-api, plus shop-deploy from Day 3. Then the cluster and the connection to Forgejo.

source ~/renovate-lab/setup/env.sh
curl -s -o /dev/null -w '%{http_code}\n' -u "$ADMIN" \
  -X DELETE "$FORGEJO/api/v1/repos/shop/shop-api"
git -C ~/renovate-lab/shop-api push -q forgejo:shop/shop-api.git main
mkdir -p ~/renovate-lab/tag10 && cd ~/renovate-lab/tag10
cp -R ~/renovate-lab/code/tag10/. .
curl -s -o /dev/null -w '%{http_code}\n' -u "$ADMIN" \
  -X DELETE "$FORGEJO/api/v1/repos/shop/shop-deploy"
rm -rf start-shop-deploy
cp -R ~/renovate-lab/code/tag03/shop-deploy start-shop-deploy
git -C start-shop-deploy init -q -b main
git -C start-shop-deploy add -A
git -C start-shop-deploy commit -qm "Initialer Stand"
git -C start-shop-deploy push -q forgejo:shop/shop-deploy.git main
kind create cluster --name renovate-lab
docker network connect kind forgejo
kubectl run nettest --rm -i --restart=Never --image=busybox:1.37 -- \
  wget -qO- http://forgejo:3000/api/v1/version

Expected (abridged):

204
204
You can now use your cluster with:
kubectl cluster-info --context kind-renovate-lab
{"version":"16.0.6+gitea-1.22.0"}
pod "nettest" deleted from default namespace

In the user-defined network kind, Docker resolves container names via DNS. The pod therefore reaches Forgejo through the kind node at forgejo:3000, the port inside the container. The pod cannot see port 3000 on your laptop.

One detail still breaks: in its API, Forgejo reports the clone URL derived from its ROOT_URL.

curl -s "$FORGEJO/api/v1/repos/shop/shop-api" | jq -r .clone_url

Expected:

http://127.0.0.1:3000/shop/shop-api.git

Inside the pod, 127.0.0.1 is the pod itself. By default Renovate clones via this clone_url and fails. The global option gitUrl: 'endpoint' builds the clone URL from the endpoint instead. You will see this in the log in Drill 6.

Save your progress? Sign up for free

Drill 2: Choosing the image

The official image is ghcr.io/renovatebot/renovate:44.153.1. How big is it? The registry tells you without you downloading any layers. First an anonymous token for ghcr.io, then the index of the tag with one manifest per platform:

TOKEN=$(curl -s "https://ghcr.io/token?scope=repository:renovatebot/renovate:pull" \
  | jq -r .token)
curl -s -H "Authorization: Bearer $TOKEN" \
  -H "Accept: application/vnd.oci.image.index.v1+json" \
  https://ghcr.io/v2/renovatebot/renovate/manifests/44.153.1 \
  | jq -r '.manifests[] | "\(.platform.architecture) \(.digest)"'

Expected:

amd64 sha256:3e173a153ec055f725b131cabc26c2804592d7af24468467cf56a6fc42327209
arm64 sha256:7d60100762a2463e44738ad0d1f2abf698af23367100bd6920f057395c8d68bf
unknown sha256:0e950141a186f3a4d28caf427000abfcbb69d6c8079c6b3a36069b1670d0990e
unknown sha256:2a2dfd3bcd10f842c9f800a3d8d2793556ba4183bf3296311870d51e22eb3528

unknown entries are attestations. The manifest of a platform lists the layers with their size. Insert the digest of your platform and convert to MB:

curl -s -H "Authorization: Bearer $TOKEN" \
  -H "Accept: application/vnd.oci.image.manifest.v1+json" \
  https://ghcr.io/v2/renovatebot/renovate/manifests/<digest> \
  | jq '[.layers[].size] | add / 1048576 | floor'

Expected (amd64):

417

The 44.153.1-full variant with all tools is about six times as large.

Unpacked, the slim image needs roughly three times that. The variants compared:

Variant Space Assessment
kind node pulls from ghcr.io itself 1 copy in the node chosen: no detour, gone with the cluster
docker pull + kind load 2 copies (host + node) only needed without internet in the node
node:24-alpine + npm install approx. 350 MB per run slow, without containerbase
-full over 2.4 GB compressed brings all tools, too large for the lab

The slim image installs missing tools such as go or helm on demand by itself (binarySource=install, Day 3). That is enough for the lab.

Warning: If Docker runs in a VM (Colima, Docker Desktop), its disk counts, not the laptop’s. If it is too small, the pod hangs in ImagePullBackOff, and kubectl -n renovate get events shows failed to copy: write /var/lib/containerd/...: no space left on device. Check beforehand with colima ssh -- df -h / or in the Docker Desktop settings whether a good 2 GB are free.

Save your progress? Sign up for free

Drill 3: Namespace, Secret, ConfigMap

The config.js from the companion code is the global config from Day 9, adapted to the cluster:

cat config.js
renovate-config-validator config.js

Expected (abridged):

module.exports = {
  platform: 'forgejo',
  endpoint: 'http://forgejo:3000/api/v1', // Containername im Docker-Netz "kind"
  gitUrl: 'endpoint', // klonen über den Endpoint-Host statt über clone_url
  gitAuthor: 'Renovate Bot <[email protected]>',
  autodiscover: true,
  autodiscoverFilter: ['shop/*'],
  repositoryCache: 'enabled',
  // Token kommt als RENOVATE_TOKEN aus dem Secret, nie aus dieser Datei
};
 INFO: Validating config.js as global config
 INFO: Config validated successfully against 1 file(s)

Now the namespace, Secret and ConfigMap. kubectl reads the token from the file; it ends up neither in the YAML nor in the shell history.

kubectl create namespace renovate
kubectl -n renovate create secret generic renovate-env \
  --from-env-file=<(printf 'RENOVATE_TOKEN=%s\n' "$(cat ../setup/bot-token)")
kubectl -n renovate create configmap renovate-config --from-file=config.js

Expected:

namespace/renovate created
secret/renovate-env created
configmap/renovate-config created

Why not simply --from-file=RENOVATE_TOKEN=../setup/bot-token? The file ends with a newline, and --from-file keeps it:

kubectl -n renovate create secret generic test --dry-run=client \
  -o jsonpath='{.data.RENOVATE_TOKEN}' \
  --from-file=RENOVATE_TOKEN=../setup/bot-token | base64 -d | tail -c 1 | od -c
RENOVATE_TOKEN="$(cat ../setup/bot-token)
" renovate --autodiscover-filter=nix 2>&1 | grep -A1 FATAL

Expected:

0000000   \n
0000001
FATAL: Initialization error
       "errorMessage": "Authentication failure"

Forgejo rejects a token with a newline, and Renovate aborts with “Authentication failure”. The --from-env-file variant strips the newline.

Save your progress? Sign up for free

Drill 4: The CronJob

cat cronjob.yaml

The most important parts (abridged):

spec:
  schedule: "0 * * * *"          # stündlich zur vollen Stunde
  timeZone: Europe/Berlin
  concurrencyPolicy: Forbid      # nie zwei Läufe gleichzeitig
  startingDeadlineSeconds: 600
  successfulJobsHistoryLimit: 3
  failedJobsHistoryLimit: 3
  jobTemplate:
    spec:
      backoffLimit: 0            # kein Retry-Sturm, nächster Lauf kommt sowieso
      activeDeadlineSeconds: 3000
      ttlSecondsAfterFinished: 86400
      template:
        spec:
          containers:
          - name: renovate
            image: ghcr.io/renovatebot/renovate:44.153.1
            env:
            - {name: RENOVATE_CONFIG_FILE, value: /config/config.js}
            - {name: RENOVATE_BASE_DIR, value: /tmp/renovate}     # Klone: emptyDir
            - {name: RENOVATE_CACHE_DIR, value: /cache/renovate}  # Caches: PVC
            envFrom:
            - secretRef: {name: renovate-env}   # RENOVATE_TOKEN
            resources:
              requests: {cpu: 250m, memory: 512Mi}
              limits: {cpu: "1", memory: 2Gi}

RENOVATE_BASE_DIR holds the Git clones. They belong on an emptyDir that disappears with the pod. RENOVATE_CACHE_DIR holds the package and repository cache and lives on the PVC renovate-cache. activeDeadlineSeconds ends a hanging run before the next scheduled time. The image runs as user 12021; fsGroup makes the PVC writable for it.

kubectl apply -f cronjob.yaml
kubectl -n renovate get cronjob,pvc

Expected (abridged):

persistentvolumeclaim/renovate-cache created
cronjob.batch/renovate created
NAME                     SCHEDULE    TIMEZONE        SUSPEND   ACTIVE   LAST SCHEDULE
cronjob.batch/renovate   0 * * * *   Europe/Berlin   False     0        <none>

NAME                                   STATUS    VOLUME   CAPACITY   ACCESS MODES
persistentvolumeclaim/renovate-cache   Pending

Pending is correct: kind’s StorageClass standard only binds the volume when the first pod uses it.

Save your progress? Sign up for free

Drill 5: Starting a run by hand

You don’t have to wait for the top of the hour. kubectl create job --from creates a Job from the CronJob’s template.

kubectl -n renovate create job --from=cronjob/renovate renovate-manual
kubectl -n renovate wait --for=condition=complete job/renovate-manual \
  --timeout=900s
kubectl -n renovate get pods,pvc

Expected (abridged, may differ depending on the version):

job.batch/renovate-manual created
job.batch/renovate-manual condition met
NAME                        READY   STATUS      RESTARTS   AGE
pod/renovate-manual-bcdcq   0/1     Completed   0          3m12s

NAME                                   STATUS   VOLUME
persistentvolumeclaim/renovate-cache   Bound    pvc-caeedb30-cb02-48ee-af06-a2b40bedbcb3

The first run takes longer because the node pulls the image. If the pod hangs, kubectl -n renovate describe pod -l job-name=renovate-manual shows the cause. The logs:

kubectl -n renovate logs job/renovate-manual | grep -E '^ (INFO|WARN|ERROR)'

Expected (abridged, may differ depending on the version):

 INFO: Renovate started
 INFO: Autodiscovered repositories
 INFO: Repository started (repository=shop/shop-api)
 INFO: Branch created (repository=shop/shop-api, branch=renovate/configure)
 INFO: Dependency extraction complete (repository=shop/shop-api, baseBranch=main)
 INFO: Onboarding PR created (repository=shop/shop-api)
 INFO: Repository finished (repository=shop/shop-api)
 INFO: Repository started (repository=shop/shop-deploy)
 INFO: Dependency extraction complete (repository=shop/shop-deploy, baseBranch=main)
 INFO: Branch created (repository=shop/shop-deploy, branch=renovate/memcached-1.x)
 INFO: PR created (repository=shop/shop-deploy, branch=renovate/memcached-1.x)
 INFO: Branch created (repository=shop/shop-deploy, branch=renovate/podinfo-6.x)
 INFO: PR created (repository=shop/shop-deploy, branch=renovate/podinfo-6.x)
 INFO: Repository finished (repository=shop/shop-deploy)

shop-api has no config yet and gets the onboarding PR. shop-deploy has had a renovate.json since Day 3 and gets update PRs right away; after two of them prHourlyLimit kicks in. Your target versions will be newer. Without RENOVATE_GITHUB_COM_TOKEN in the Secret, the pod skips updates for GitHub Actions (Day 3). Add it as a second key in renovate-env if needed.

Save your progress? Sign up for free

Drill 6: Verifying PRs in Forgejo

The pod is gone, the work is in Forgejo. Who opened the PRs?

for r in shop-api shop-deploy; do
  curl -s -u "$ADMIN" "$FORGEJO/api/v1/repos/shop/$r/pulls?state=open" \
    | jq -r --arg r "$r" '.[] | "\($r) #\(.number) \(.user.login) | \(.title)"'
done

Expected:

shop-api #1 renovate-bot | Configure Renovate
shop-deploy #2 renovate-bot | Update Helm release podinfo to v6.15.0
shop-deploy #1 renovate-bot | Update memcached Docker tag to v1.6.45

And which URL did the pod clone from? The debug log shows it. To see it, start a second Job with LOG_LEVEL=debug:

kubectl -n renovate create job --from=cronjob/renovate renovate-debug \
  --dry-run=client -o yaml \
  | sed 's/value: info/value: debug/' | kubectl apply -f -
kubectl -n renovate wait --for=condition=complete job/renovate-debug --timeout=600s
kubectl -n renovate logs job/renovate-debug \
  | grep -A1 'using URL based on configured endpoint' | head -2

Expected (abridged, may differ depending on the version):

DEBUG: using URL based on configured endpoint (repository=shop/shop-api)
       "url": "http://***@forgejo:3000/shop/shop-api.git"

Without gitUrl, this would say Using HTTP URL: http://127.0.0.1:3000/shop/shop-api.git. Renovate masks the token in the URL by itself.

Save your progress? Sign up for free

Drill 7: Repository cache on the PVC

With repositoryCache: 'enabled', Renovate remembers the state of branches and PRs per repo. If nothing changes in the repo, it even skips the clone. That only works if the cache survives the pod.

kubectl -n renovate logs job/renovate-debug \
  | grep -E 'Repository cache is|Repository finished' -A2 \
  | grep -E 'cache is|repository=|cloned|durationMs'

Expected (abridged, may differ depending on the version):

DEBUG: Repository cache is restored from revision 13 (repository=shop/shop-api)
 INFO: Repository finished (repository=shop/shop-api)
       "cloned": false,
       "durationMs": 119,
DEBUG: Repository cache is restored from revision 13 (repository=shop/shop-deploy)
 INFO: Repository finished (repository=shop/shop-deploy)
       "cloned": true,
       "durationMs": 2065,

Measured in the lab with the same config.js, the second run each time:

Cache lives on shop-api shop-deploy
PVC (persists) 0.1 s, no clone 2.3 s
emptyDir (empty for every pod) 7.2 s, clone 12.1 s
very first run 9.4 s, clone 17.6 s

With two repos these are seconds, with 500 repos hours. The cache files live on the PVC under renovate/repository/forgejo/<org>/<repo>.json.

Tip: A PVC with ReadWriteOnce is enough as long as concurrencyPolicy: Forbid prevents parallel runs. For multiple Renovate instances, Renovate offers repositoryCacheType with an S3 bucket.

Save your progress? Sign up for free

Drill 8: Schedule and concurrency

concurrencyPolicy: Forbid skips the next scheduled run as long as the previous one is still running. This only applies to Jobs the CronJob creates itself. It does not know your manual Jobs:

kubectl -n renovate get events --field-selector involvedObject.kind=CronJob \
  | cut -c1-88

Expected (abridged):

LAST SEEN   TYPE      REASON          OBJECT             MESSAGE
4m24s       Warning   UnexpectedJob   cronjob/renovate   Saw a job that the controller d

If you start one by hand while a scheduled run is active, two pods work on the same repos and the same cache at the same time. So check beforehand with kubectl -n renovate get jobs whether one is running. You pause the schedule without deleting it:

kubectl -n renovate patch cronjob renovate -p '{"spec":{"suspend":true}}'
kubectl -n renovate get cronjob renovate -o jsonpath='{.spec.suspend}{"\n"}'
kubectl -n renovate patch cronjob renovate -p '{"spec":{"suspend":false}}'

Expected (abridged):

cronjob.batch/renovate patched
true
cronjob.batch/renovate patched

Save your progress? Sign up for free

Drill 9: Other runners

The same config also runs in CI. These variants were not tested live in the lab, but checked against the official documentation (as of October 2026).

GitLab with renovate-runner: a dedicated project, e.g. renovate-bot/runner, with this .gitlab-ci.yml:

include:
  - project: 'renovate-bot/renovate-runner'
    file: '/templates/renovate.gitlab-ci.yml'
    ref: v26.1.0
# Self-managed GitLab without access to gitlab.com: instead of project/file/ref
#  - remote: https://gitlab.com/renovate-bot/renovate-runner/-/raw/v26.1.0/
#            templates/renovate.gitlab-ci.yml   (on a single line)

In the CI/CD variables: RENOVATE_TOKEN (project, group or personal access token with api, read_user, write_repository, masked), optionally RENOVATE_GITHUB_COM_TOKEN and RENOVATE_EXTRA_FLAGS, for example --autodiscover=true --autodiscover-filter=shop/* --onboarding=false. The template sets platform, endpoint, RENOVATE_REPOSITORY_CACHE=enabled and the GitLab CI cache for the repository cache. The job only runs when $CI_PIPELINE_SOURCE == "schedule". So create a schedule under Build > Pipeline schedules (the documentation suggests 3 * * * *). There, the role of concurrencyPolicy is taken over by resource_group: production.

GitHub with renovatebot/github-action, authenticated as a GitHub App:

name: Renovate
on:
  schedule:
    - cron: '17 * * * *'
  workflow_dispatch:
concurrency: renovate          # like concurrencyPolicy: Forbid (waits instead of aborting)
jobs:
  renovate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/create-github-app-token@v3
        id: app-token
        with:
          client-id: ${{ vars.RENOVATE_APP_CLIENT_ID }}
          private-key: ${{ secrets.RENOVATE_APP_PRIVATE_KEY }}
          owner: ${{ github.repository_owner }}
      - uses: actions/[email protected]
      - uses: renovatebot/[email protected]
        with:
          configurationFile: config.js
          renovate-version: 44.153.1
          token: ${{ steps.app-token.outputs.token }}
        env:
          RENOVATE_AUTODISCOVER: 'true'

The action automatically passes variables with the prefix RENOVATE_ into the container. Without an app, a classic PAT with scope repo works (plus workflow for the github-actions manager). With the built-in GITHUB_TOKEN, Renovate PRs do not trigger any further workflows.

Forgejo Actions: There is no official action. A job in the Renovate image is enough, provided a runner with the label docker is registered (abridged, may differ depending on the version):

# .forgejo/workflows/renovate.yml in the repo shop/renovate-runner
on:
  schedule:
    - cron: '0 * * * *'
  workflow_dispatch:
jobs:
  renovate:
    runs-on: docker
    container:
      image: ghcr.io/renovatebot/renovate:44.153.1
    steps:
      - run: renovate
        env:
          RENOVATE_PLATFORM: forgejo
          RENOVATE_ENDPOINT: ${{ github.server_url }}/api/v1
          RENOVATE_TOKEN: ${{ secrets.RENOVATE_TOKEN }}
          RENOVATE_AUTODISCOVER: 'true'
          RENOVATE_AUTODISCOVER_FILTER: 'shop/*'

schedule only applies to workflows on the default branch. No runner is registered in the lab, as you can see from the pending CI status of the Renovate PRs (Day 5).

Where it runs Trigger Token Strengths
K8s CronJob schedule in the CronJob, create job --from Secret, bot PAT platform-neutral, PVC cache, limits
GitLab renovate-runner Pipeline schedule CI variable, project/group token ready-made template, logs as artifact
GitHub Action on: schedule, workflow_dispatch GitHub App or PAT fine-grained app permissions, no server
Forgejo Actions on: schedule, workflow_dispatch Actions secret, bot PAT everything in Forgejo, needs a runner

Save your progress? Sign up for free

Checkpoint

Forgejo is also attached to the Docker network kind:

cd ~/renovate-lab/tag10
docker ps --filter name=forgejo --format '{{.Networks}}'

Expected:

R10_NET

CronJob, Secret and cache in the namespace renovate:

K="kubectl --context kind-renovate-lab -n renovate"
$K get cronjob renovate -o jsonpath='{.spec.concurrencyPolicy}'; echo
$K get secret renovate-env -o name
$K get cm renovate-config -o yaml | grep -cF "$RENOVATE_TOKEN"
$K get pvc renovate-cache -o jsonpath='{.status.phase}'; echo

Expected: the token does not appear in the ConfigMap.

Forbid
secret/renovate-env
0
Bound

The manual Job succeeded, and the onboarding PR comes from the bot:

$K get job renovate-manual -o jsonpath='{.status.succeeded}'; echo
curl -s -u "$ADMIN" "$FORGEJO/api/v1/repos/shop/shop-api/pulls?state=all" \
  | jq -r '.[].user.login'

Expected:

1
renovate-bot

Challenge

shop/shop-deploy should additionally run every hour at half past, and only this repo. For this, create a second CronJob renovate-deploy that uses the same ConfigMap and the same Secret, and prove via the log that it does not touch shop-api.

Hint: RENOVATE_REPOSITORIES alone is not enough as long as config.js contains autodiscover: true. Environment variables take precedence over the config file.

Solution

The companion code contains challenge/cronjob-deploy.yaml. Compared with cronjob.yaml, the name, the schedule and two variables change:

metadata:
  name: renovate-deploy
spec:
  schedule: "30 * * * *"         # stündlich, versetzt zum Haupt-Job
  # ...
            env:
            - {name: RENOVATE_CONFIG_FILE, value: /config/config.js}
            - {name: RENOVATE_AUTODISCOVER, value: "false"}  # sonst ignoriert
            - {name: RENOVATE_REPOSITORIES, value: shop/shop-deploy}
kubectl apply -f challenge/cronjob-deploy.yaml
kubectl -n renovate create job --from=cronjob/renovate-deploy deploy-manual
kubectl -n renovate wait --for=condition=complete job/deploy-manual --timeout=600s
kubectl -n renovate logs job/deploy-manual | grep -E 'Autodiscover|Repository (st|fi)'

Expected (abridged, may differ depending on the version):

cronjob.batch/renovate-deploy created
job.batch/deploy-manual created
job.batch/deploy-manual condition met
 INFO: Repository started (repository=shop/shop-deploy)
 INFO: Repository finished (repository=shop/shop-deploy)

Without RENOVATE_AUTODISCOVER=false, Autodiscovered repositories and both repos appear in the log: autodiscover replaces the repo list. Both CronJobs share the PVC. The staggered schedules avoid overlaps but guarantee nothing, because Forbid only works within a single CronJob.

Cleanup for Day 11: delete the cluster, detach Forgejo from the network kind. Forgejo itself keeps running.

docker network disconnect kind forgejo
kind delete cluster --name renovate-lab
docker system df | head -3

Expected (abridged):

Deleting cluster "renovate-lab" ...
Deleted nodes: ["renovate-lab-control-plane"]
TYPE            TOTAL     ACTIVE    SIZE      RECLAIMABLE
Images          24        6         13.9GB    2.71GB (19%)

The Renovate image only lived in the kind node and disappeared with the cluster. The kindest/node image stays around for later clusters.

Save your progress? Sign up for free

Enterprise Note

  • In production, a secret backend (External Secrets, Vault, Sealed Secrets) delivers the token instead of kubectl create secret. Rotate it, and monitor the logs for “Authentication failure”.
  • Pin the image by digest, mirror it into the internal registry and let Renovate update the CronJob itself, with review instead of automerge.
  • Set LOG_FORMAT=json and collect the logs centrally. Alert on failed Jobs (kube_job_status_failed) and on runs that exceed activeDeadlineSeconds.
  • From a few hundred repos on, split them across several CronJobs via autodiscoverFilter, each with its own cache, or use repositoryCacheType with S3.
  • NetworkPolicy: egress only to the Git platform, registries and proxy. Behind a proxy, the pod and Git need HTTPS_PROXY/NO_PROXY with the internal platform host.