Windows Subsystem for Linux 2 (WSL 2) Tips, Tricks, and Techniques by Stuart Leeks

Windows Subsystem for Linux 2 (WSL 2) Tips, Tricks, and Techniques by Stuart Leeks

Author:Stuart Leeks
Language: eng
Format: mobi, epub
Publisher: Packt Publishing Pvt Ltd
Published: 2020-10-20T16:00:00+00:00


Figure 7.7 – A screenshot showing the Kubernetes web application in the browser

This screenshot shows the web application loaded in a browser and the hostname that it displays matches one of the pod names we saw when we listed the pods after scaling the deployment. If you refresh the page a few times, you will see the name changes between the pod names we created after scaling the deployment, showing that the Kubernetes service we created is distributing the traffic between the pods.

We have been interactively running kubectl commands to create deployments and services, but a powerful aspect of Kubernetes is its support for declarative deployments. Kubernetes allows you to define objects such as deployments and services in files written in the YAML format. In this way, you can specify multiple aspects of your system and then pass the set of YAML files to Kubernetes in one go and Kubernetes will create them all. You can later update the YAML specification and pass it to Kubernetes, and it will reconcile the differences in the specification to apply your changes. An example of this is in the code accompanying the book in the chapter-07/02-deploy-to-kubernetes folder (refer to the README.md file in the folder for instructions on how to deploy).

In this section, we've taken a look at how to deploy our web application packaged as a container image using a Kubernetes deployment. We saw how this creates pods for us and allows us to dynamically scale the number of pods that we have running. We also saw how we can use Kubernetes to create a service that distributes traffic across the pods in our deployment. This service gives a logical abstraction over the pods in the deployment and handles scaling the deployment as well as pods that have restarted (for example, if it has crashed). This gives a good starting point for working with Kubernetes, and if you want to take it further, Kubernetes has a great interactive tutorial at https://kubernetes.io/docs/tutorials/kubernetes-basics/.

Note

If you are interested in digging deeper into using Docker or Kubernetes for building applications, the following links give a good starting point (with further links to other content):

https://docs.docker.com/develop/

https://kubernetes.io/docs/home/



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.