Home Explore Blog CI



docker

3rd chunk of `content/guides/kube-deploy.md`
1544d4cdb8382a5825b2c725cfc45f8ee33020c2838e590e0000000100000cb8
- 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 Todo app from the network.

Also, notice that while Kubernetes YAML can appear long and complicated at first, it almost always follows the same pattern:

- The `apiVersion`, which indicates the Kubernetes API that parses this object
- The `kind` indicating what sort of object this is
- Some `metadata` applying things like names to your objects
- The `spec` specifying all the parameters and configurations of your object.

## Deploy and check your application

1. In a terminal, navigate to where you created `bb.yaml` and deploy your application to Kubernetes:

   ```console
   $ kubectl apply -f bb.yaml
   ```

   You should see output that looks like the following, indicating your Kubernetes objects were created successfully:

   ```shell
   deployment.apps/bb-demo created
   service/bb-entrypoint created
   ```

2. Make sure everything worked by listing your deployments:

   ```console
   $ kubectl get deployments
   ```

   if all is well, your deployment should be listed as follows:

   ```shell
   NAME      READY   UP-TO-DATE   AVAILABLE   AGE
   bb-demo   1/1     1            1           40s
   ```

   This indicates all one of the pods you asked for in your YAML are up and running. Do the same check for your services:

   ```console
   $ kubectl get services

   NAME            TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)          AGE
   bb-entrypoint   NodePort    10.106.145.116   <none>        3000:30001/TCP   53s
   kubernetes      ClusterIP   10.96.0.1        <none>        443/TCP          138d
   ```

   In addition to the default `kubernetes` service, we see our `bb-entrypoint` service, accepting traffic on port 30001/TCP.

3. Open a browser and visit your Todo app at `localhost:30001`. You should see your Todo application, the same as when you ran it as a stand-alone container in [Part 2](02_our_app.md) of the tutorial.

4. Once satisfied, tear down your application:

   ```console
   $ kubectl delete -f bb.yaml
   ```

## Conclusion

At this point, you have successfully used Docker Desktop to deploy your application to a fully-featured Kubernetes environment on your development machine. You can now add other components to your app and taking advantage of all the features and power of Kubernetes, right on your own machine.

In addition to deploying to Kubernetes, you have also described your application as a Kubernetes YAML file. This simple text file contains everything you need to create your application in a running state. You can check it in to version control and share it with your colleagues. This let you distribute your applications to other clusters (like the testing and production clusters that probably come after your development environments).

## Kubernetes references

Further documentation for all new Kubernetes objects used in this article are available here:

- [Kubernetes Pods](https://kubernetes.io/docs/concepts/workloads/pods/pod/)
- [Kubernetes Deployments](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/)
- [Kubernetes Services](https://kubernetes.io/docs/concepts/services-networking/service/)

Title: Deploying and Verifying the Application on Kubernetes
Summary
This section provides step-by-step instructions to deploy the application to Kubernetes using the `bb.yaml` file. It includes commands to check the status of deployments and services, ensuring that the application is running correctly. The section also guides the user on how to access the Todo app in a browser via `localhost:30001` and how to tear down the application using `kubectl delete -f bb.yaml`. It concludes by highlighting the successful deployment of the application to Kubernetes, the advantages of using YAML files for application description, and provides links to Kubernetes documentation for further learning.