3.2.5.2 Setting Up an Optional Local Registry

If the systems that you are using for your Kubernetes cluster nodes do not have direct access to the Internet and are unable to connect directly to the Oracle Container Registry, you can set up a local Docker registry to perform this function. The kubeadm-ha-setup tool provides an option to change the registry that you use to obtain these images. Instructions to set up a local Docker registry are provided in Oracle® Linux: Oracle Container Runtime for Docker User's Guide.

When you have set up a local Docker registry, you must pull the images required to run Oracle Linux Container Services for use with Kubernetes, tag these images and then push them to your local registry. The images must be tagged identically to the way that they are tagged in the Oracle Container Registry. The kubeadm-ha-setup matches version numbers during the setup process and cannot successfully complete many operations if it cannot find particular versions of images. To assist with this process, Oracle Linux Container Services for use with Kubernetes provides the kubeadm-registry.sh tool in the kubeadm package.

To use the kubeadm-registry.sh tool to automatically pull images from the Oracle Container Registry, tag them appropriately, and push them to your local registry:

  1. If you are using the Oracle Container Registry to obtain images, log in following the instructions in Section 2.2.5, “Oracle Container Registry Requirements”. If you are using one of the Oracle Container Registry mirrors, see Section 3.2.5.1, “Using an Oracle Container Registry Mirror” for more information.

  2. Run the kubeadm-registry.sh tool with the required options:

    # kubeadm-registry.sh --to host.example.com:5000

    Substitute host.example.com:5000 with the resolvable domain name and port by which your local Docker registry is available.

    You may optionally use the --from option to specify an alternate registry to pull the images from. You may also use the --version option to specify the version of Kubernetes images that you intend to host. For example:

    # kubeadm-registry.sh --to host.example.com:5000 --from \
      container-registry-phx.oracle.com/kubernetes --version 1.12.0
Important

If you are upgrading your environment and you intend to use a local registry, you must make sure that you have the most recent version of the images required to run Oracle Linux Container Services for use with Kubernetes. You can use the kubeadm-registry.sh tool to pull the correct images and to update your local registry before running the upgrade on the master node.

After your local Docker registry is installed and configured and the required images have been imported, you must set the environment variable that controls which registry server the kubeadm-ha-setup tool uses. On each of the systems where you intend to run the kubeadm-ha-setup tool run the following commands:

# export KUBE_REPO_PREFIX="local-registry.example.com:5000/kubernetes"
# echo 'export KUBE_REPO_PREFIX="local-registry.example.com:5000/kubernetes"' > ~/.bashrc

Substitute local-registry.example.com with the IP address or resolvable domain name of the host on which your local Docker registry is configured.