This isn’t very relivant to what I’m doing - but I wanted to include this, because in OpenShift it’s more streamlined and this confused me at first.
Setting up an internal Docker registry
I don’t have a fancy storage solution. I literally just threw another physical block of storage on my instance and my persistent volumes are based on that. This has its limitations, but here I don’t really mind. Kubernetes supports a ton of other options.
First: Let’s make some storage objects. hostPath is just a 100gb block device I mounted on /mnt/data.
Run a kubectl create -f on these files and then kubectl get pvc registry-claim should return something like this:
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGEregistry-claim Bound pv-registry 5Gi RWO local-fast 2h
So, what did we do here? In summary, a PersistentVolume is a cluster resource that captures the details of the implementation of a said storage. Storage is requested by users via a PersistentVolumeClaim, providing a layer of abstraction. Since PersistentVolumes can have varying properties and users can have a variety of needs, StorageClasses are needed to govern how that is handled. I suggest giving the docs on Storage Volumes , Persistent Volumes, and Storage Classes read, because my usage is pretty minimal.
Now that we have storage, we can deploy the registry from a template. We need to create two services and a deployment:
I based this off Kenzalab’s implementation with some adjustments, as theirs is in the context of Minikube.
Context: Services are a gateway of communication for pods, Deployments are configurations to how they’re launched. I’ll be going into detail about how these work in later posts. For now, just do a kubectl get svc and pay attention to this part - Just like in docker, the PORT(S) is just an internal to external translation.
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
registry NodePort hmm <none> 5000:30400/TCP 5h
registry-ui NodePort hmm <none> 8080:30473/TCP 3h