- To authenticate to the private registry
docker login registry.gitlab.com
- Create the docker authentication credential as a Kubernetes secret (regcred)
kubectl create secret generic regcred \
--from-file=.dockerconfigjson=$HOME/.docker/config.json \
--type=kubernetes.io/dockerconfigjson \
--namespace=your-kubernetes-namespace-here
- To configure the credential on a docker-compose yaml (for Kompose).
version: "3.7"
services:
st-gateway-service:
image: registry.gitlab.com/your-container-image-here:latest
container_name: your-container-name-here
restart: always
ports:
- "8080:8080"
env_file:
- .env
environment:
- TZ=America/Santiago
labels:
#kompose.service.expose: PUBLIC-IP-ADDRESS (OPTIONAL)
kompose.controller.type: deployment
kompose.image-pull-secret: regcred
- Transform docker-compose to Kubernetes manifest using "kompose"
kompose convert -f docker-compose.yml -o kubectl/prod/