The task is to write the Kubernetes deployment manifests to run Docker registry in Kubernetes with at least the following
- deployment
- service
- persistent volume claim
- garbage collect cron job
- ingress
- secret (if needed).
Make sure Docker registry uses Redis for cache and you run 2 replicas of Docker registry for redundancy.
Record any issues you encounter. You’re also welcome to list improvement ideas for the service that are outside the scope of this assignment.
Write a script that implements Docker registry retention.
There are containers with various tags pushed to the Docker registry which runs on premises,
e.g. app/calculator:v1 , app/calculator:v2 , app/calculator:latest, app/calculator:v5, app/jmeter:v2 etc.
There is a need to go through all of the repositories in the registry and retain only the last X images.
We might need to keep 10 images of the app/calculator and 5 images of app/jmeter - the retention job should be able
to work with different retention settings.
Usual choice is a Jenkins pipeline written in Groovy but do not be limited by that, feel free to choose your
own language and method to periodically run the retention job.
This directory contains a Kubernetes chart to deploy a private Docker Registry.
- PV support on underlying infrastructure (if persistence is required)
This chart will do the following:
- Implement a Docker registry deployment
To install the chart, use the following:
$ helm install --namespace default docker-registry ./docker-registry --values ./docker-registry/values.yaml
change namespace
to your namespace
The following table lists the configurable parameters of the docker-registry chart and their default values.
Parameter | Description | Default |
---|---|---|
image.pullPolicy |
Container pull policy | IfNotPresent |
image.repository |
Container image to use | registry |
image.tag |
Container image tag to deploy | 2.8.1 |
imageRedis.pullPolicy |
Container pull policy | IfNotPresent |
imageRedis.repository |
Container image to use | bitnami/redis |
imageRedis.tag |
Container image tag to deploy | 6.2 |
service.port |
TCP port on which the service is exposed | 5000 |
replicaCount |
k8s replicas count | 2 |
updateStrategy |
update strategy for deployment | {} |
podAnnotations |
Annotations for pod | {} |
resources.limits.cpu |
Container requested CPU | nil |
resources.limits.memory |
Container requested memory | nil |
resourcesRedis.limits.cpu |
Container requested CPU | nil |
resourcesRedis.limits.memory |
Container requested memory | nil |
secrets.htpasswd |
Htpasswd authentication | nil |
secrets.haSharedSecret |
Shared secret for Registry | nil |
secrets.redisPassword |
Redis password | nil |
configData |
Configuration file for docker registry | nil |
ingress.enabled |
If true, Ingress will be created | false |
ingress.annotations |
Ingress annotations | {} |
ingress.labels |
Ingress labels | {} |
ingress.path |
Ingress service path | / |
ingress.hosts |
Ingress hostnames | [] |
extraEnvVars |
Additional environment variables to the pod | [] |
Specify each parameter using the --set key=value[,key=value]
argument to
helm install
.
To generate htpasswd file, run this docker command:
docker run --entrypoint htpasswd registry:2 -Bbn user password > ./htpasswd
.