Db2 Operator V2 Prechecker

The Db2 Operator V2 Prechecker validates deployment configurations and environment prerequisites before starting a Db2 instance. Learn how to configure the Prechecker, interpret validation results, and troubleshoot deployment issues.

Overview

The Prechecker is an automated validation feature that runs before your Db2 instance starts. It checks your deployment configuration and environment to ensure all prerequisites are met, helping you avoid deployment failures and configuration issues.

What Does the Prechecker Do?

The Prechecker performs validation checks on:

  • System requirements and resource availability
  • Configuration parameters and settings
  • Security and permission requirements
  • Storage and network prerequisites
  • Compatibility and version requirements

When issues are detected, the Prechecker provides feedback through status messages, allowing you to fix problems before they impact your deployment.

Default Behavior

The Prechecker is enabled by default for all Db2 Operator V2 instances. The feature is preconfigured and automatically runs as port of the deployment.

Configuration

Basic configuration

The Prechecker is configured in your Db2uInstance custom resource under spec.environment.prechecker:

apiVersion: db2u.databases.ibm.com/v1
kind: Db2uInstance
metadata:
  name: my-db2-instance
  annotations:
    db2u.databases.ibm.com/next_gen: "true"
spec:
  image: icr.io/db2u/db2u.db2oltp:v12.1.5.0
  environment:
    prechecker:
      enabled: true  # Default: true
      disabledPrechecks: []  # Optional: list of checks to skip

Disabling the Prechecker

While not recommended, you can disable the Prechecker if needed:

spec:
  environment:
    prechecker:
      enabled: false

Skipping checks

If a specific validation check does not apply to your environment, you can skip the check while keeping other checks active:

spec:
  environment:
    prechecker:
      enabled: true
      disabledPrechecks:
        - "SELINUX"

Understanding Prechecker Results

Deployment States

The Prechecker can produce three outcomes:

Success
  • All validation checks passed
  • Deployment proceeds normally
  • No action required
Warning
  • Non-critical issues detected
  • Deployment proceeds but issues should be reviewed
  • Check the CR conditions for details
Error
  • Critical issues detected
  • Deployment is blocked
  • Issues must be resolved before deployment can proceed

Checking Prechecker status

Use the following steps to determine whether the Prechecker ran successfully and to troubleshoot any issues.

Check overall Prechecker status
Run the following command to view the prechecker condition in your Db2uInstance:
kubectl get db2uinstance <db2-instance-name> -o jsonpath='{.status.conditions[?(@.type=="Prechecker")]}'
View pod status
Run the following command:
kubectl get pods <db2u_pod_name>

If the Prechecker fails, the pod(s) will be in Init:CrashLoopBackOff state.

View Prechecker logs
To see detailed validation results:
kubectl logs <db2u_pod_name> -c prechecker
View previous Prechecker logs
If the init container has restarted, for example, after a failure, the default command only shows logs from the latest run. To view logs from the previous (failed) run of the Prechecker container, use:
kubectl logs <db2u_pod_name> -c prechecker --previous

Troubleshooting Guide

Problem: Cannot locate Prechecker logs.

Solution:

  1. List all containers in the pod:
    kubectl get pod <pod-name> -o jsonpath='{.spec.initContainers[*].name}'
  2. If Prechecker is not listed, check if it is enabled:
    kubectl get db2uinstance <instance-name> -o jsonpath='{.spec.environment.prechecker.enabled}'

Problem: Prechecker keeps failing

Solution:

  1. Capture the full error output:
    kubectl describe pod <pod-name>
  2. Check the termination message:
    kubectl get pod <pod-name> -o jsonpath='{.status.initContainerStatuses[?(@.name=="prechecker")].state.terminated.message}'
  3. If the issue persists, collect diagnostic information:
    kubectl get db2uinstance <instance-name> -o yaml > instance.yaml
    kubectl describe pod <pod-name> > pod-describe.txt
    kubectl logs <pod-name> -c prechecker > prechecker.log
  4. Contact IBM Support with the collected information.

Problem: Need to temporarily bypass Prechecker

Solution (Use with caution):

spec:
  environment:
    prechecker:
      enabled: false
Important: Re-enable the Prechecker as soon as the temporary issue is resolved.

Related Documentation

  • Core Reconciler Logic
  • Validation Webhook