Configuring Private Docker Image Access for HiveMQ Platform Operator
This article provides a step-by-step guide for enabling access to a private Docker image and integrating it into the HiveMQ Platform Operator.
Instructions
Creating a Kubernetes Secret for Docker Registry Credentials
To allow Kubernetes to access your private Docker image, you need to create a Kubernetes Secret containing your Docker registry credentials. Execute the following command:
kubectl create secret docker-registry my-docker-private-regcred \ --docker-server=https://index.docker.io/v1/ \ --docker-username=mydockerusername \ --docker-password=mydockerpassword \ --docker-email=mydocker@email.com
Verifying the Kubernetes Secret
To ensure that the secret has been created successfully, run the following command:
kubectl describe secret my-docker-private-regcred --namespace hivemq
You should see output similar to the following:
Name: my-docker-private-regcred Namespace: hivemq Labels: <none> Annotations: <none> Type: kubernetes.io/dockerconfigjson Data ==== .dockerconfigjson: 149 bytes
Preparing the HiveMQ Platform Values File
The HiveMQ Platform requires a custom values file to specify the private Docker image details. Create or modify a file named my-hivemq-platform-values.yaml with the following content:
image: repository: docker.io/mydockerusername name: my-docker-image tag: 4.35.0 pullPolicy: Always pullSecretName: "my-docker-private-regcred"
Updating the Helm Deployment
Apply the updated values file to your HiveMQ Platform deployment using the Helm package manager. Use the following command:
helm upgrade my-hivemq-platform --install hivemq/hivemq-platform --values my-hivemq-platform-values.yaml
Verifying the Deployment
To confirm that the deployment is using the correct Docker image, execute the following command:
kubectl get pod my-hivemq-platform-0 --namespace hivemq --output jsonpath='{.status.containerStatuses}' | jq '.[] | select(.name == "hivemq") | .image'
The output should display the image in the following format:
"docker.io/mydockerusername/my-docker-image:4.35.0"
By completing these steps, you have successfully configured the HiveMQ Platform Operator to use a private Docker image.