Hot-Patch an Arbitrary Image in Your Deployment

After deploying Rok on Kubernetes you might want to perform post-installation configurations to fine-tune your cluster and environment. For example, you may need to configure Rok to use an internal container registry.

This section will guide you through setting custom container images for the components of Rok and Rok Registry. Depending on your environment and needs you might have to edit Rok manifests to specify a custom repository, name, or tag for the container images of individual Rok components.

In order to update Rok and its components you need to

  1. Edit the corresponding YAML manifests inside your local GitOps deployment repository.
  2. Commit your changes.
  3. Re-apply the YAML manifests in order for your changes to take effect.
  4. (Optionally) Push the committed changes to a remote.

For this, we will demonstrate a standard Edit-Commit-Apply cycle using git and rok-deploy --apply. You may want to apply this cycle for one or more Rok components.

Important

For applying changes we have a custom tool, which is rok-deploy --apply. This tool is similar to kubectl apply. To run rok-deploy --apply you need to explicitly specify the paths to the Kustomize packages you wish to apply.

The kustomization snippets provided below modify both the name and the tag of Rok images. Depending on your needs you might need to set one or both of them. For example,

  • To change gcr.io/arrikto-deploy/rok-operator:v1 to gcr.io/arrikto-deploy/rok-operator:v2, set only newTag.
  • To change gcr.io/arrikto-deploy/rok-operator:v1 to custom.registry/rok-operator:v1, set only newName.
  • To change gcr.io/arrikto-deploy/rok-operator:v1 to custom.registry/rok-operator:v2, set both newName and newTag.

What You’ll Need

Rok Operator for Rok Cluster

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

    root@rok-tools:~# cd ~/ops/deployments
    
  2. Edit rok/rok-operator/overlays/deploy/kustomization.yaml and insert the following snippet:

    images:
    - name: gcr.io/arrikto-deploy/rok-operator
      newName: custom.registry/rok-operator
      newTag: release-1.3-l0-release-1.3-rc8
    
  3. Stage changes for commit:

    root@rok-tools:~/ops/deployments# git add rok/rok-operator
    
  4. Commit changes:

    root@rok-tools:~/ops/deployments# git commit -m "Update Rok Operator container image"
    

    Note

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

  5. Apply the kustomization:

    root@rok-tools:~/ops/deployments# rok-deploy --apply rok/rok-operator/overlays/deploy
    

Rok Disk Manager

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

    root@rok-tools:~# cd ~/ops/deployments
    
  2. Edit rok/rok-disk-manager/overlays/deploy/kustomization.yaml and insert the following snippet:

    images:
    - name: gcr.io/arrikto-deploy/rok-disk-manager
      newName: custom.registry/rok-disk-manager
      newTag: release-1.3-l0-release-1.3-rc8
    
  3. Stage changes for commit:

    root@rok-tools:~/ops/deployments# git add rok/rok-disk-manager
    
  4. Commit changes:

    root@rok-tools:~/ops/deployments# git commit -m "Update Rok Disk Manager container image"
    

    Note

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

  5. Apply the kustomization:

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

Rok kmod

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

    root@rok-tools:~# cd ~/ops/deployments
    
  2. Edit rok/rok-kmod/overlays/deploy/kustomization.yaml and insert the following snippet:

    images:
    - name: gcr.io/arrikto-deploy/rok-kmod
      newName: custom.registry/rok-kmod
      newTag: release-1.3-l0-release-1.3-rc8
    
  3. Stage changes for commit:

    root@rok-tools:~/ops/deployments# git add rok/rok-kmod
    
  4. Commit changes:

    root@rok-tools:~/ops/deployments# git commit -m "Update Rok kmod container image"
    

    Note

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

  5. Apply the kustomization:

    root@rok-tools:~/ops/deployments# rok-deploy --apply rok/rok-kmod/overlays/deploy
    

RokCluster

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

    root@rok-tools:~# cd ~/ops/deployments
    
  2. Edit rok/rok-cluster/overlays/deploy/kustomization.yaml and insert the following snippet:

    images:
    - name: gcr.io/arrikto-deploy/roke
      newName: custom.registry/roke
      newTag: release-1.3-l0-release-1.3-rc8
    - name: gcr.io/arrikto-deploy/rok-csi
      newName: custom.registry/rok-csi
      newTag: release-1.3-l0-release-1.3-rc8
    
  3. Stage changes for commit:

    root@rok-tools:~/ops/deployments# git add rok/rok-cluster
    
  4. Commit changes:

    root@rok-tools:~/ops/deployments# git commit -m "Update RokCluster container image"
    

    Note

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

  5. Apply the kustomization:

    root@rok-tools:~/ops/deployments# rok-deploy --apply rok/rok-cluster/overlays/deploy
    

Rok Operator for Rok Registry

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

    root@rok-tools:~# cd ~/ops/deployments
    
  2. Edit rok/rok-operator/overlays/registry/deploy/kustomization.yaml and insert the following snippet:

    images:
    - name: gcr.io/arrikto-deploy/rok-operator
      newName: custom.registry/rok-operator
      newTag: release-1.3-l0-release-1.3-rc8
    
  3. Stage changes for commit:

    root@rok-tools:~/ops/deployments# git add rok/rok-operator
    
  4. Commit changes:

    root@rok-tools:~/ops/deployments# git commit -m "Update Rok Operator container image"
    

    Note

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

  5. Apply the kustomization:

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

RokRegistryCluster

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

    root@rok-tools:~# cd ~/ops/deployments
    
  2. Edit rok/rok-registry-cluster/overlays/deploy/kustomization.yaml and insert the following snippet:

    images:
    - name: gcr.io/arrikto-deploy/rok-registry
      newName: custom.registry/rok-registry
      newTag: release-1.3-l0-release-1.3-rc8
    
  3. Stage changes for commit:

    root@rok-tools:~/ops/deployments# git add rok/rok-registry-cluster
    
  4. Commit changes:

    root@rok-tools:~/ops/deployments# git commit -m "Update RokRegistryCluster container image"
    

    Note

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

  5. Apply the kustomization:

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

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.