Kubernetes explained: Understand the basics for capitalizing on containers

By IBM Cloud Education

  • Deploy, update and scale new applications quickly with less risk of disruptions to production 
  • Test new releases in parallel with production code and, if necessary, roll back gracefully 
  • Create a strong foundation for developing cloud-native applications
  • Automate operations and free development resources for new initiatives

Increasingly over the past several years, application developers have come to rely on container technology to increase the portability of their code and help ensure their applications run consistently across a variety of platforms. Because a container includes required runtime resources along with application code, you can move containerized applications easily within and across cloud platforms with little or no modification. Containers let you take important steps toward shortening deployment time and improving application reliability. 

However, adopting a container platform for developing and releasing applications can present new questions: How can you simplify container deployments and streamline ongoing management? Seamlessly execute application upgrades? Maintain high availability of deployed applications? To realize the full potential of containers, you need a way to orchestrate your containerized applications using available cloud infrastructure.

Ready to learn more about how Kubernetes can benefit your organization? IBM Cloud offers a simple tutorial to walk you through the process of setting up a continuous integration and delivery pipeline for containerized applications running on the IBM Cloud™ Kubernetes Service.

 

What is Kubernetes?

Kubernetes is a container orchestration system that you set up and drive with declarative confirmation statements. It enables you to easily automate operations tasks, creating a cohesive and continuous workflow that includes permissions oversight and policy enforcement. 

First introduced as an open source distributed computing platform by Google in 2014, Kubernetes continues to gain popularity among developers. With more than 1,400 contributors, the Kubernetes open source community is now one of the largest in the world. IBM and other vendors have developed enterprise versions of Kubernetes with added security, manageability and support features.

 

Defining Kubernetes components

The basic management unit of Kubernetes is the pod, a collection of containers that share the same resources and context. Think of the pod as your application — it is a bundle of microservices that comprise the application’s business logic. Pods that work together are grouped into Kubernetes services and share a static virtual IP address and a DNS name. Docker is the most commonly used container technology, but Kubernetes supports other runtimes as well. 

A Kubernetes cluster consists of master and worker nodes. The master node constitutes the Kubernetes control plane, which manages the workload and directs communications across the system. The master node includes a scheduler that controls performance, capacity and availability, and an API server that manages communications with the outside world. Worker nodes (which can be virtual or physical machines) run the pods under the direction of the master node. Configuration files allow users to specify operational parameters — for example, the number of pods that should be running at any time. Using Kubernetes at its full potential, you can flexibly manage resources in an entire data center as if it were a single system with well-defined workload priorities. 

Many developers consider Helm to be an essential tool for using Kubernetes. Helm is a package manager conceptually similar to OS-level package managers such as Homebrew, apt and yum/rpm. Helm Charts reduce the complexity of Kubernetes applications, simplify updates and facilitate sharing.

 

Kubernetes continuous delivery architecture

An architecture for setting up continuous integration and delivery for containerized apps with Kubernetes

 

Exploring Kubernetes benefits 

What can Kubernetes do for you? It can help you simplify deployment of new applications, streamline application and resource management, reduce upgrade risks, avoid downtime, quickly scale application components, either individually or as a group, and develop portable cloud-native applications. 

 

Simplify deployment 

Deploying a new application release has traditionally involved a time-consuming and error-prone process. You start by provisioning and spinning up a new host server, then migrate the release code to the server. Once the release is running, you begin to divert production traffic from the current server to the new server. If everything goes as planned, you can then deprovision the existing server. If something does go wrong, you might need to scramble to divert production traffic back to the current server and troubleshoot the problem on the new server. 

In the Kubernetes world, deployment is quite different. Instead of creating a detailed checklist of process steps, you simply capture the specifics of the deployment in a configuration file, defining, for example, how many instances of the application should be running at the same time. Kubernetes automatically manages the rollout, making a smooth transition from the current version to the new version. In the event of a problem, Kubernetes rolls back the release gracefully, avoiding downtime. 

To help you manage your deployment in the most effective and efficient way for your organization, Kubernetes offers a range of deployment strategies. For example:

  • Recreate: Simultaneously terminate the old version and release the new one
  • Ramped: Release the new version as a set of rolling updates 
  • Blue/green: Spin up the new version alongside the old version, then switch over production traffic
  • Canary: Release a new version to a subset of users, then proceed to a full rollout

 

Streamline application and resource management

A microservices architecture allows developers to break up applications into smaller units with clear boundaries. This modularity enables a well-distributed development process in which smaller teams can focus on specific microservices that have well-defined interactions with other microservices. However, managing applications at scale requires another layer of technology.

That’s where Kubernetes comes in. Deploying containers into pods allows containers to share resources such as file systems, kernel namespaces and an IP address, while also maintaining isolation from other processes. You can collect containerized microservices with the same roles into pods, and clone containers and pods as needed based on declared configuration rules. Pods that have similar functions are organized into services that enable discovery, visibility, horizontal scaling and load balancing. Deployed in pods, a cloud-native application built with microservices flexes in real time to increase and decrease infrastructure resources.

 

Reduce upgrade risk

When it comes to version releases, Kubernetes reduces the risk of outages that affect availability and degrade user experience. Rather than simply “throwing the switch” to the new version all at once, you can easily test a new version in parallel with the current production version. Then you can gradually scale up the new deployment as you simultaneously scale down the current version. Should something go wrong, Kubernetes can automatically walk back the rollout and return to the previous known good state.

 

Boost availability

Designing for high availability can be challenging. How much redundancy is the right amount? Too much redundancy drives down hardware utilization and lowers ROI. Too little runs the risk of an unforeseen event causing downtime — for example, a multiple-node failure. 

Kubernetes helps you boost efficiency and achieve high availability. Operations managers can specify the required number of running pods, for example, which Kubernetes uses to monitor worker node clusters and spin up replacement pods immediately in the event of failure or insufficient throughput. This automated response can both avoid outages and limit their duration when they happen.

 

Improve DevOps efficiency

Many developers like Kubernetes because it automates the processes of scaling production applications and managing version updates — functions that otherwise consume valuable application development time. Recapturing that time will enable you to refocus team members on new projects that provide your organization with a competitive advantage.

 

Develop portable cloud-native applications 

As more organizations move toward implementation of hybrid cloud environments, developers must design for application portability. Kubernetes is designed to work in any cloud configuration. By developing with Kubernetes, you can reduce the need to rewrite applications as they are migrated between on-premises and cloud infrastructure.

 

Going forward

Drawing on Google’s extensive experience in container orchestration and backed by open source vendors such as IBM, Red Hat and others, Kubernetes has a strong position as a vital container deployment and management tool.

Ready to learn more about how Kubernetes can benefit your organization? IBM Cloud offers a simple tutorial to walk you through the process of setting up a continuous integration and delivery pipeline for containerized applications running on the IBM Cloud Kubernetes Service.