Hot-Patch an Arbitrary Image in Your Deployment

This section will guide you through setting custom container images for the components of Rok and Rok Registry.

Contact Arrikto

This is an advanced guide that you should not follow, unless Arrikto has instructed you to do so. Arrikto should first provide you with a custom container image and its <TAG>, for each component that you are going to hot-patch.

What You'll Need

Procedure

Note

Repeat the procedure below for every Rok and Rok Registry component that you wish to hot-patch. Choose the corresponding tab at the beginning of each iteration.

  1. Go to your GitOps repository inside your rok-tools management environment:

    root@rok-tools:~# cd ~/ops/deployments
    
  2. Edit the corresponding YAML manifests:

    Edit the rok/rok-operator/overlays/deploy/kustomization.yaml file and append the following snippet. Replace <REGISTRY> with the new custom container registry and/or <TAG> with the new image tag. If you only want to set a new custom registry, keep the line starting with newName: and remove the line starting with newTag:. Similarly, if you only want to set a new image tag, keep the line starting with newTag: and remove the line starting with newName::

    images:
    - name: gcr.io/arrikto-deploy/rok-operator
      newName: <REGISTRY>/rok-operator
      newTag: <TAG>
    

    For example, to change only the image <TAG> to release-1.2, append the following snippet:

    images:
    - name: gcr.io/arrikto-deploy/rok-operator
      newTag: release-1.2
    

    As another example, to change both the image <TAG> to release-1.2 and the <REGISTRY> to gcr.io/arrikto-playground, append the following snippet:

    images:
    - name: gcr.io/arrikto-deploy/rok-operator
      newName: gcr.io/arrikto-playground/rok-operator
      newTag: release-1.2
    

    Edit the rok/rok-disk-manager/overlays/deploy/kustomization.yaml file and append the following snippet. Replace <REGISTRY> with the new custom container registry and/or <TAG> with the new image tag. If you only want to set a new custom registry, keep the line starting with newName: and remove the line starting with newTag:. Similarly, if you only want to set a new image tag, keep the line starting with newTag: and remove the line starting with newName::

    images:
    - name: gcr.io/arrikto-deploy/rok-disk-manager
      newName: <REGISTRY>/rok-disk-manager
      newTag: <TAG>
    

    For example, to change only the image <TAG> to release-1.2, append the following snippet:

    images:
    - name: gcr.io/arrikto-deploy/rok-disk-manager
      newTag: release-1.2
    

    As another example, to change both the image <TAG> to release-1.2 and the <REGISTRY> to gcr.io/arrikto-playground, append the following snippet:

    images:
    - name: gcr.io/arrikto-deploy/rok-disk-manager
      newName: gcr.io/arrikto-playground/rok-disk-manager
      newTag: release-1.2
    

    Edit the rok/rok-kmod/overlays/deploy/kustomization.yaml file and append the following snippet. Replace <REGISTRY> with the new custom container registry and/or <TAG> with the new image tag. If you only want to set a new custom registry, keep the line starting with newName: and remove the line starting with newTag:. Similarly, if you only want to set a new image tag, keep the line starting with newTag: and remove the line starting with newName::

    images:
    - name: gcr.io/arrikto-deploy/rok-kmod
      newName: <REGISTRY>/rok-kmod
      newTag: <TAG>
    

    For example, to change only the image <TAG> to release-1.2, append the following snippet:

    images:
    - name: gcr.io/arrikto-deploy/rok-kmod
      newTag: release-1.2
    

    As another example, to change both the image <TAG> to release-1.2 and the <REGISTRY> to gcr.io/arrikto-playground/, append the following snippet:

    images:
    - name: gcr.io/arrikto-deploy/rok-kmod
      newName: gcr.io/arrikto-playground/rok-kmod
      newTag: release-1.2
    

    Edit the rok/rok-cluster/overlays/deploy/kustomization.yaml file and append the following snippet. Replace <REGISTRY> with the new custom container registry and/or <TAG> with the new image tag. If you only want to set a new custom registry, keep the line starting with newName: and remove the line starting with newTag:. Similarly, if you only want to set a new image tag, keep the line starting with newTag: and remove the line starting with newName::

    images:
    - name: gcr.io/arrikto-deploy/roke
      newName: <REGISTRY>/roke
      newTag: <TAG>
    - name: gcr.io/arrikto-deploy/rok-csi
      newName: <REGISTRY>/rok-csi
      newTag: <TAG>
    

    For example, to change only the image <TAG> to release-1.2, append the following snippet:

    images:
    - name: gcr.io/arrikto-deploy/roke
      newTag: release-1.2
    - name: gcr.io/arrikto-deploy/rok-csi
      newTag: release-1.2
    

    As another example, to change both the image <TAG> to release-1.2 and the <REGISTRY> to gcr.io/arrikto-playground/, append the following snippet:

    images:
    - name: gcr.io/arrikto-deploy/roke
      newName: gcr.io/arrikto-playground/roke
      newTag: release-1.2
    - name: gcr.io/arrikto-deploy/rok-csi
      newName: gcr.io/arrikto-playground/rok-csi
      newTag: release-1.2
    

    Edit the rok/rok-operator/overlays/registry/deploy/kustomization.yaml file and append the following snippet. Replace <REGISTRY> with the new custom container registry and/or <TAG> with the new image tag. If you only want to set a new custom registry, keep the line starting with newName: and remove the line starting with newTag:. Similarly, if you only want to set a new image tag, keep the line starting with newTag: and remove the line starting with newName::

    images:
    - name: gcr.io/arrikto-deploy/rok-operator
      newName: <REGISTRY>/rok-operator
      newTag: <TAG>
    

    For example, to change only the image <TAG> to release-1.2, append the following snippet:

    images:
    - name: gcr.io/arrikto-deploy/rok-operator
      newTag: release-1.2
    

    As another example, to change both the image <TAG> to release-1.2 and the <REGISTRY> to gcr.io/arrikto-playground, append the following snippet:

    images:
    - name: gcr.io/arrikto-deploy/rok-operator
      newName: gcr.io/arrikto-playground/rok-operator
      newTag: release-1.2
    

    Edit the rok/rok-registry-cluster/overlays/deploy/kustomization.yaml file and append the following snippet. Replace <REGISTRY> with the new custom container registry and/or <TAG> with the new image tag. If you only want to set a new custom registry, keep the line starting with newName: and remove the line starting with newTag:. Similarly, if you only want to set a new image tag, keep the line starting with newTag: and remove the line starting with newName::

    images:
    - name: gcr.io/arrikto-deploy/rok-registry
      newName: <REGISTRY>/rok-registry
      newTag: <TAG>
    

    For example, to change only the image <TAG> to release-1.2, append the following snippet:

    images:
    - name: gcr.io/arrikto-deploy/rok-registry
      newTag: release-1.2
    

    As another example, to change both the image <TAG> to release-1.2 and the <REGISTRY> to gcr.io/arrikto-playground, append the following snippet:

    images:
    - name: gcr.io/arrikto-deploy/rok-registry
      newName: gcr.io/arrikto-playground/rok-registry
      newTag: release-1.2
    

    Note

    If the lines in the snippet already exist in the kustomization.yaml change them to match the snippet instead of appending new ones.

  3. Commit changes:

    root@rok-tools:~/ops/deployments# git commit -am "Update Rok Operator container image"
    
    root@rok-tools:~/ops/deployments# git commit -am "Update Rok Disk Manager container image"
    
    root@rok-tools:~/ops/deployments# git commit -am "Update Rok kmod container image"
    
    root@rok-tools:~/ops/deployments# git commit -am "Update Rok container image"
    
    root@rok-tools:~/ops/deployments# git commit -am "Update Rok Operator for Rok Registry container image"
    
    root@rok-tools:~/ops/deployments# git commit -am "Update Rok Registry container image"
    

    Note

    Optionally, you can push your local changes to a remote of your choice.

  4. Apply the kustomization:

    root@rok-tools:~/ops/deployments# rok-deploy --apply rok/rok-operator/overlays/deploy
    
    root@rok-tools:~/ops/deployments# rok-deploy --apply rok/rok-disk-manager/overlays/deploy
    
    root@rok-tools:~/ops/deployments# rok-deploy --apply rok/rok-kmod/overlays/deploy
    
    root@rok-tools:~/ops/deployments# rok-deploy --apply rok/rok-cluster/overlays/deploy
    
    root@rok-tools:~/ops/deployments# rok-deploy --apply rok/rok-operator/overlays/registry/deploy
    
    root@rok-tools:~/ops/deployments# rok-deploy --apply rok/rok-registry-cluster/overlays/deploy
    

Verify

Note

Repeat the procedure below for every Rok and Rok Registry component whose image you wish to verify. Choose the corresponding tab at the beginning of each iteration.

  1. Extract the container image used in the corresponding Kubernetes resource:

    root@rok-tools:~/ops/deployments# kubectl -n rok-system get sts rok-operator \
    > -o=custom-columns=':spec.template.spec.containers[*].image' --no-headers
    gcr.io/arrikto-playground/rok-operator:release-1.2
    
    root@rok-tools:~/ops/deployments# kubectl -n rok-system get ds rok-disk-manager \
    > -o=custom-columns=':spec.template.spec.containers[*].image' --no-headers
    gcr.io/arrikto-playground/rok-disk-manager:release-1.2
    
    root@rok-tools:~/ops/deployments# kubectl -n rok-system get ds rok-kmod \
    > -o=custom-columns=':spec.template.spec.containers[*].image' --no-headers
    gcr.io/arrikto-playground/rok-kmod:release-1.2
    
    root@rok-tools:~/ops/deployments# kubectl -n rok get rokcluster rok \
    > -o=custom-columns=':spec.images.rok' --no-headers
    gcr.io/arrikto-playground/roke:release-1.2
    
    root@rok-tools:~/ops/deployments# kubectl -n rok get rokcluster rok \
    > -o=custom-columns=':spec.images.rokCSI' --no-headers
    gcr.io/arrikto-playground/rok-csi:release-1.2
    
    root@rok-tools:~/ops/deployments# kubectl -n rok-registry-system get sts rok-registry-operator \
    > -o=custom-columns=':spec.template.spec.containers[*].image' --no-headers
    gcr.io/arrikto-playground/rok-operator:release-1.2
    
    root@rok-tools:~/ops/deployments# kubectl -n rok-registry get rokregistrycluster rok-registry \
    > -o=custom-columns=':spec.images.rokRegistry' --no-headers
    gcr.io/arrikto-playground/rok-registry:release-1.2
    
  2. Verify that the container image is the correct one:

    Ensure that the image is the same as <REGISTRY>/rok-operator:<TAG>.

    Ensure that the image is the same as <REGISTRY>/rok-disk-manager:<TAG>.

    Ensure that the image is the same as <REGISTRY>/rok-kmod:<TAG>.

    Ensure that the images are the same as <REGISTRY>/roke:<TAG> and <REGISTRY>/rok-csi:<TAG>.

    Ensure that the image is the same as <REGISTRY>/rok-operator:<TAG>.

    Ensure that the image is the same as <REGISTRY>/rok-registry:<TAG>.

Summary

You have successfully set custom images for Rok and Rok Registry components.

What's Next

Check out the rest of the maintenance operations that you can perform on your cluster.