How to Deploy a Docker Container to Kubernetes
Once you have a Docker container, it is really simple to deploy containers to Kubernetes.
Generate a Deployment YAML
kubectl
provides a fantastic way to help generate deployment yamls.
|
|
Perform the Deployment
Now that we have a deployment yaml, we can simply run:
|
|
What next?
Next you might want to add a Service so that the deployment is available to the world.
Open up the deployment yaml file generated and add the following:
Note that the above Service uses a LoadBalancer
type, listens for requests on port 80, forwards them onto port 5000 to the app specified in the selector
label.
We called this <app_name>
above, which you should swap out with whatever appname you chose before. This is specified by the label
used in the original yaml.