It is assumed that you have already created your Host Group running Kubernetes and have a Docker account.
Save Docker Credentials to Kubernetes Cluster
Open an SSH terminal on the Kubernetes Master host and run:
kubectl create secret docker-registry regcred --docker-username=<your-name> --docker-password=<your-password> --docker-email=<your-email> -n <your-namespace>
where <namespace> = the namespace into which you wish to deploy your application
Create YAML File
As an example we will illustrate deploying a public version of Redis, a popular in-memory key-value database from Docker Hub. However, the steps described also extend to any other application in a Docker repository, either public or private.
The .yaml file we will create, called private-reg-pod.yaml, specifies the configuration of the Redis database; in this example we will deploy a single Redis pod.
While there are more production-ready implementations of Redis, they are outside the scope of this guide. The command below creates an empty .yaml file called private-reg-pod.yaml
Create private-reg-pod.yaml using the editor of your choice. In this example we are using the Vim Editor:
Press <i> to begin editing and enter (or copy/paste):
- name: redis
- name: regcred
Press <Esc> to exit edit.
Type :wq to save and exit Vim.
Note - you can download the unmodified version of the.yaml file using the command below and then make changes appropriate for your own use case.
Deploy your newly configured Redis onto your Kubernetes cluster by running:
kubectl apply -f my-private-reg-pod.yaml
You are now ready to place your own Docker Container(s)...