This simple text file contains everything we need to create our application in a running state. In addition to deploying to Kubernetes, we have also described our application as a Kubernetes YAML file. We haven’t done much with Kubernetes yet, but the door is now open you can begin adding other components to your app and taking advantage of all the features and power of Kubernetes, right on your own machine. In a terminal, navigate to where you created bb.yaml and deploy your application to Kubernetes:Īt this point, we have successfully used Docker Desktop to deploy our application to a fully-featured Kubernetes environment on our development machine. The spec specifying all the parameters and configurations of your object.Some metadata applying things like names to your objects.The kind indicating what sort of object this is.The apiVersion, which indicates the Kubernetes API that parses this object.A NodePort service, which will route traffic from port 30001 on your host to port 3000 inside the pods it routes to, allowing you to reach your bulletin board from the network.Īlso, notice that while Kubernetes YAML can appear long and complicated at first, it almost always follows the same pattern:.In this case, you’ll get just one replica, or copy of your pod, and that pod (which is described under the template: key) has just one container in it, based off of your bulletinboard:1.0 image from the previous step in this tutorial. A Deployment, describing a scalable group of identical pods.
In this Kubernetes YAML file, we have two objects, separated by the -: Place the following in a file called bb.yaml:ĪpiVersion : apps/v1 kind : Deployment metadata : name : bb-demo namespace : default spec : replicas : 1 selector : matchLabels : bb : web template : metadata : labels : bb : web spec : containers : - name : bb-site image : getting-started - apiVersion : v1 kind : Service metadata : name : bb-entrypoint namespace : default spec : type : NodePort selector : bb : web ports : - port : 3000 targetPort : 3000 nodePort : 30001 Now, let’s write a slightly more sophisticated YAML file to run and manage our bulletin board. You already wrote a very basic Kubernetes YAML file in the Orchestration overview part of this tutorial. These YAML files describe all the components and configurations of your Kubernetes app, and can be used to easily create and destroy your app in any Kubernetes environment. Lastly, all Kubernetes objects can and should be described in manifests called Kubernetes YAML files. Furthermore, in a realistic application we almost never create individual pods instead, most of our workloads are scheduled as deployments, which are scalable groups of pods maintained automatically by Kubernetes. Describing apps using Kubernetes YAMLĪll containers in Kubernetes are scheduled as pods, which are groups of co-located containers that share some resources. The Kubernetes environment created by Docker Desktop is fully featured, meaning it has all the Kubernetes features your app will enjoy on a real cluster, accessible from the convenience of your development machine.
#HOW TO USE DOCKER AND KUBERNETES FULL#
In order to validate that our containerized application works well on Kubernetes, we’ll use Docker Desktop’s built in Kubernetes environment right on our development machine to deploy our application, before handing it off to run on a full Kubernetes cluster in production.
Kubernetes provides many tools for scaling, networking, securing and maintaining your containerized applications, above and beyond the abilities of containers themselves. Now that we’ve demonstrated that the individual components of our application run as stand-alone containers, it’s time to arrange for them to be managed by an orchestrator like Kubernetes. If Kubernetes isn’t running, follow the instructions in Orchestration of this tutorial to finish setting it up.
#HOW TO USE DOCKER AND KUBERNETES INSTALL#
Download and install Docker Desktop as described in Orientation and setup.Estimated reading time: 6 minutes Prerequisites