"oc patch pod" fails with "Forbidden: pod updates may not change fields..."

Solution Verified - Updated -

Issue

  • When trying to apply a patch to a Pod, it fails as some other field (DNSConfig in the example below) is also changed:

    $ oc patch pod -n ibm-common-services setup-job-9cv74 -p '{"metadata":{"finalizers":null}}'
    The Pod "setup-job-9cv74" is invalid: spec: Forbidden: pod updates may not change fields other than `spec.containers[*].image`, `spec.initContainers[*].image`, `spec.activeDeadlineSeconds`, `spec.tolerations` (only additions to existing tolerations) or `spec.terminationGracePeriodSeconds` (allow it to be set to 1 if it was previously negative)
      core.PodSpec{
        ... // 22 identical fields
        Priority:         &0,
        PreemptionPolicy: &"PreemptLowerPriority",
    -   DNSConfig:        &core.PodDNSConfig{Options: []core.PodDNSConfigOption{{Name: "single-request-reopen"}}},
    +   DNSConfig:        nil,
        ReadinessGates:   nil,
        RuntimeClassName: nil,
        ... // 4 identical fields
      }
    

Environment

  • Red Hat OpenShift Container Platform (RHOCP) 4.10

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content