Docker Kubernetes Ubuntu

2/12/2022by admin

Kubernetes is an open source platform for managing container technologies such as Docker. Docker lets you create containers for a pre-configured image and application. Kubernetes provides the next step, allowing you to balance loads between containers and run multiple containers across multiple systems. Kubernetes is a tool for orchestrating and managing Docker containers at scale on on-prem server or across hybrid cloud environments. Kubeadm is a tool provided with Kubernetes to help users install a production ready Kubernetes cluster with best practices enforcement.

Estimated reading time: 6 minutes

20.04

Nginx Docker Ansible Kubernetes Ubuntu 18.04. Last Validated on April 24, 2019 Originally Published on July 31, 2018 Not using Ubuntu 18.04?

Prerequisites

Docker Kubernetes Ubuntu
  • Download and install Docker Desktop as described in Orientation and setup.
  • Work through containerizing an application in Part 2.
  • Make sure that Kubernetes is enabled on your Docker Desktop:
    • Mac: Click the Docker icon in your menu bar, navigate to Preferences and make sure there’s a green light beside ‘Kubernetes’.
    • Windows: Click the Docker icon in the system tray and navigate to Settings and make sure there’s a green light beside ‘Kubernetes’.

    If Kubernetes isn’t running, follow the instructions in Orchestration of this tutorial to finish setting it up.

Docker Kubernetes Ubuntu

Introduction

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. Kubernetes provides many tools for scaling, networking, securing and maintaining your containerized applications, above and beyond the abilities of containers themselves.

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. 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.

Describing apps using Kubernetes YAML

All containers in Kubernetes are scheduled as pods, which are groups of co-located containers that share some resources. 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. Lastly, all Kubernetes objects can and should be described in manifests called Kubernetes YAML files. 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.

  1. You already wrote a very basic Kubernetes YAML file in the Orchestration overview part of this tutorial. Now, let’s write a slightly more sophisticated YAML file to run and manage our bulletin board. Place the following in a file called bb.yaml:

    In this Kubernetes YAML file, we have two objects, separated by the ---:

    • A Deployment, describing a scalable group of identical pods. 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 NodePort service, which will route traffic from port 30001 on your host to port 8080 inside the pods it routes to, allowing you to reach your bulletin board 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

Kubernetes Ubuntu Docker Image

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

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

  2. Make sure everything worked by listing your deployments:

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

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

    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 bulletin board at localhost:30001; you should see your bulletin board, the same as when we ran it as a stand-alone container in Part 2 of the Quickstart tutorial.

  4. Once satisfied, tear down your application:

Conclusion

At this point, we have successfully used Docker Desktop to deploy our application to a fully-featured Kubernetes environment on our development machine. 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 addition to deploying to Kubernetes, we have also described our application as a Kubernetes YAML file. This simple text file contains everything we need to create our application in a running state. We can check it into version control and share it with our colleagues, allowing us to distribute our applications to other clusters (like the testing and production clusters that probably come after our development environments) easily.

Kubernetes references

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

kubernetes, pods, deployments, kubernetes services

In an era where container technologies have taken the industry by storm, one of the most common online searches on the topic of containers is ‘Kubernetes vs Docker’. The relevance and accuracy of this comparison is questionable, as it is not really comparing apples to apples. In this blog post, we will attempt to clarify both terms, present their commonalities and differences, and help users better navigate the ever-growing container ecosystem.

What are containers?

Let’s start with a short definition of containers. Containers package application software with their dependencies in order to abstract it from the infrastructure it runs on. A containerised application can be deployed easily and consistently on a local machine, a private data centre, a public cloud, or any other compute infrastructure. They are often compared to virtual machines (VMs), as they provide similar resource isolation and allocation capabilities. Containers are more lightweight and portable than VMs, as they only virtualise the operating system instead of the hardware layer. Containers are a standard feature of the Linux kernel since the introduction of cgroups by Google in 2006.

Learn more about containers and their history in our e-book >

Docker Kubernetes Ubuntu Free

What is Docker?

Docker was launched in 2013 by Docker, Inc. as an open source containerisation platform. It promised an easy way to build and deploy containers on the cloud or on-premises and is compatible with Linux and Windows. Although Docker did not introduce a new concept, its ‘new way to deploy software’ and ‘faster time-to-market’ messaging appealed to users so much that Docker soon became shorthand for containers and the default container format.

Docker streamlines the creation of containers with tools such as the dockerfile and docker-compose. It also helps developers move workloads from their local environment, to test up to production by removing the cross-environment inconsistencies and dependencies. This results in faster delivery of the software and an increase in quality.

What is Kubernetes?

The evolution of container technology has led to the growth of its own popularity. Developers started to build and deploy containerised applications, breaking down monolithic apps into microservices for resource optimisation and easier maintenance. As a result, the industry saw a significant spike in the use of containers, and consequently, businesses were now facing new challenges in managing and deploying them.

Enter Kubernetes, an open-source project made available by Google in 2014. Kubernetes is an orchestrator of container platforms, such as Docker. Kubernetes allows users to define the desired state of their container architecture deployment on various substrates. Following user input, Kubernetes can deploy and manage multi-container applications across multiple hosts, taking action if needed to maintain the desired state. This level of automation has revolutionised the container space as it created the framework for features such as scalability, monitoring and cross-platform deployments.

What is the relationship between Docker and Kubernetes?

So if ‘Docker is containers’ and ‘Kubernetes is container orchestration’ why would anyone ask “Should I use Docker or Kubernetes”? In reality, the two tools are actually complementary to each other and help build cloud-native or microservice architectures.

Docker is mostly used during the first days of a containerised application. It actually helps build and deploy the application’s container(s). In cases where the application’s architecture is fairly simple, Docker can address the basic needs of the application’s lifecycle management.

In cases where the application is broken down into multiple microservices, each one with their own lifecycle and operational needs, Kubernetes comes into play. Kubernetes is not used to create the application containers; it actually needs a container platform to run, Docker being the most popular one. Kubernetes integrates with a large toolset built for and around containers and uses it in its own operations. Containers created with Docker or any of its alternatives can be managed, scaled and moved by Kubernetes, which also ensures failover management and health maintenance of the system.

There are great benefits to using Kubernetes with Docker:

  • Applications are easier to maintain as they are broken down into smaller parts
  • These parts run on an infrastructure that is more robust and the applications are more highly available
  • Applications are able to handle more load on-demand, improving user experience and reducing resource waste. As applications become more scalable, there is no need to pre-allocate resources in anticipation of load peak times.

Both Docker and Kubernetes are backed by strong open-source communities and are part of the Cloud Native Computing Foundation (CNCF), a Linux foundation project aiming to advance container technologies and align the industry around specific standards.

Docker Kubernetes Ubuntu 16.04

Kubernetes vs Docker Swarm

Users often compare Kubernetes with Docker. Hopefully, we have now made clear the reasons why this isn’t a valid comparison. In order to compare two similar container technologies, one should look at Kubernetes vs Docker Swarm. Docker Swarm is Docker, Inc’s container orchestration solution. Swarm is tightly integrated into the Docker ecosystem and has its own API.

Ubuntu Docker Kubernetes

This tight integration is one of the advantages of Swarm over Kubernetes, as transitioning to it from Docker is quite easy. Kubernetes brings its own GUI, scoring points with users that are keener on using a graphical interface than the command line. In terms of tooling, Kubernetes is vastly richer, more extensible and customisable than Swarm, especially when it comes to system monitoring and auto-scaling. Overall, Swarm is considered a simpler solution that can be easier to get started and is suitable mainly for development use cases. Kubernetes is not tied to Docker, supports more complex workflows and is used significantly more frequently in production environments.

Conclusion

Docker Desktop Kubernetes Ubuntu

Containerised applications bring elastic scalability, isolation and portability, especially when comparing them to monolithic solutions. Docker provides an open standard to package and distribute containerised applications and is sufficient to address simple use cases.

Businesses that have complex application architectures are moving to Kubernetes to handle their cross-infrastructure scalability and resilience needs. Kubernetes leverages a large tooling ecosystem along with continuous integration/continuous deployment (CI/CD) and other DevOps practices to orchestrate large sets of containers, from development to production environments.

Using Docker and Kubernetes together can bring value for businesses looking to thrive in a cloud-native environment, as this reduces time-to-market, makes applications easier to maintain, and addresses traffic increases.

Learn more about Kubernetes by Canonical >

What’s the risk of unsolved vulnerabilities in Docker images?

Recent surveys found that many popular containers had known vulnerabilities. Container images provenance is critical for a secure software supply chain in production. Benefit from Canonical’s security expertise with the LTS Docker images portfolio, a curated set of application images, free of vulnerabilities, with a 24/7 commitment.

Docker Install Kubernetes Ubuntu

Newsletter signup
Comments are closed.