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
Configure
Create private-reg-pod.yaml using the editor of your choice. In this example we are using the Vim Editor:
vim private-reg-pod.yaml
Press <i> to begin editing and enter (or copy/paste):
apiVersion: v1
kind: Pod
metadata:
name: redis
spec:
containers:
- name: redis
image: docker.io/redis
imagePullSecrets:
- 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
Deploy your newly configured Redis onto your Kubernetes cluster by running:
kubectl apply -f my-private-reg-pod.yaml
Next Steps
You are now ready to place your own Docker Container(s)...
Comments
0 comments
Article is closed for comments.