Managing Docker containers with Kubernetes
Services and Replication
Kubernetes supports two other very interesting features that I have not mentioned so far. Using a replication controller, you can scale pods horizontally. On the basis of a pod label, you can tell Kubernetes to provide the pod x times. Kubernetes then generates the desired number of instances of the container and makes them available on the existing minions. Kubernetes also handles the task of keeping the number of instances up to date. For example, if you stipulated that you want to have four instances of your Apache pods, Kubernetes would automatically start or stop Apache Docker instances until the number of instances corresponds to the definition.
Even if the individual containers get IP addresses from a network block defined previously in Docker, access to the individual instances of a pod are more typically via services. To offer this access, Kubernetes drops a kind of abstraction layer over specific pods of the same type and assigns a single IP address to this service. Access to the individual instances of a pod is then via that service IP. To allow this to happen, the request to the service IP is forwarded to the individual minions, and the kubelet proxy service on the minions is responsible for forwarding the request to the correct container.
You can imagine such a service as a kind of load balancer for a specific set of pods (Figure 1). For this system to work, every minion host must have an additional network segment from which the pod is then assigned an IP address. The kubelet proxy services forward the request to exactly this IP address. However, the only cloud provider that offers such a network configuration out of the box is the Google cloud platform. For all other providers, even if you use the Atomic image from this article in a local virtualization environment, a manual Docker service configuration is required. See the Docker documentation [9].
The flannel
tool [10], which is included in the most recent releases of the Atomic image, makes it very easy to set up overlay networks, which Docker can then draw on, thus saving you from extensive manual configuration.
Conclusions
Even though Kubernetes is currently profoundly beta and the tool's emphasis on the Google cloud engine is obvious, the gains in flexibility compared with plain vanilla Docker installations are already huge. Kubernetes defines an additional abstraction layer for the existing hardware resources and makes them available as a large pool of hardware.
Which system ultimately runs the container is unimportant. Kubernetes independently pools the necessary resources and starts the container wherever resources are available. Through the use of replication controllers, the framework also helps to scale existing containers horizontally.
Kubernetes services help to facilitate access to a service through a single IP address, thus eliminating the cumbersome process of discovering container IP addresses. This feature is particularly valuable when you consider the fact that containers can be short lived; they are typically restarted just a short time later on a different host; thus, their IP address might change. Services abstract these changes, removing the need for configurations such as upstream load balancers.
Infos
- Google Kubernetes: https://github.com/kubernetes/kubernetes
- Project Atomic: http://www.projectatomic.io/
- Red Hat Enterprise Linux 7 Atomic host: http://www.redhat.com/en/about/blog/small-footprint-big-impact-red-hat-enterprise-linux-7-atomic-host-beta-now-available
- Fedora Atomic host: https://getfedora.org/en/cloud/download/
- CentOS 7 Atomic host: http://buildlogs.centos.org/rolling/7/
- Etcd API documentation: https://github.com/coreos/etcd/blob/master/Documentation/api.md/
- Setup instructions for an Atomic VM https://access.redhat.com/articles/rhel-atomic-documentation/
- Cloud-init documentation: https://cloudinit.readthedocs.org/en/latest/
- Docker network documentation: http://docs.docker.com/engine/userguide/networking/
- Flannel overlay network: https://github.com/coreos/flannel/
« Previous 1 2
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Canonical Bumps LTS Support to 12 years
If you're worried that your Ubuntu LTS release won't be supported long enough to last, Canonical has a surprise for you in the form of 12 years of security coverage.
-
Fedora 40 Beta Released Soon
With the official release of Fedora 40 coming in April, it's almost time to download the beta and see what's new.
-
New Pentesting Distribution to Compete with Kali Linux
SnoopGod is now available for your testing needs
-
Juno Computers Launches Another Linux Laptop
If you're looking for a powerhouse laptop that runs Ubuntu, the Juno Computers Neptune 17 v6 should be on your radar.
-
ZorinOS 17.1 Released, Includes Improved Windows App Support
If you need or desire to run Windows applications on Linux, there's one distribution intent on making that easier for you and its new release further improves that feature.
-
Linux Market Share Surpasses 4% for the First Time
Look out Windows and macOS, Linux is on the rise and has even topped ChromeOS to become the fourth most widely used OS around the globe.
-
KDE’s Plasma 6 Officially Available
KDE’s Plasma 6.0 "Megarelease" has happened, and it's brimming with new features, polish, and performance.
-
Latest Version of Tails Unleashed
Tails 6.0 is based on Debian 12 and includes GNOME 43.
-
KDE Announces New Slimbook V with Plenty of Power and KDE’s Plasma 6
If you're a fan of KDE Plasma, you'll be thrilled to hear they've announced a new Slimbook with an AMD CPU and the latest version of KDE Plasma desktop.
-
Monthly Sponsorship Includes Early Access to elementary OS 8
If you want to get a glimpse of what's in the pipeline for elementary OS 8, just set up a monthly sponsorship to help fund its continued existence.