Log in / Register Account

Containers

Learning Kubernetes basics

Containers let developers focus on their apps while operations focus on the infrastructure—container orchestration is the way you manage these deployments across an enterprise.

Kubernetes is an open source container orchestration platform that automates many of the manual processes involved in deploying, managing, and scaling containerized applications.

Kubernetes can help you deliver and manage containerized, legacy, and cloud-native apps at scale, as well as those being refactored into microservices across environments, including private cloud and major public cloud providers like Amazon Web Services (AWS), Google Cloud, IBM Cloud, and Microsoft Azure.

 

Kubernetes architecture

Kubernetes gives you the platform to schedule and run containers on clusters of physical or virtual machines. Kubernetes architecture divides a cluster into components that work together to maintain the cluster's defined state.

A Kubernetes cluster is a set of node machines for running containerized applications. You can visualize a Kubernetes cluster as two parts: the control plane and the compute machines, or nodes. Each node is its own Linux® environment, and could be either a physical or virtual machine. Each node runs pods, which are made up of containers.

The Kubernetes API (application programming interface) is the front end of the Kubernetes control plane and is how users interact with their Kubernetes cluster. The API server determines if a request is valid and then processes it.

The Kubernetes API is the interface used to manage, create, and configure Kubernetes clusters. It's how the users, external components, and parts of your cluster all communicate with each other.

This quick Kubernetes tutorial shows you how to create a cluster and deploy an application. 

 

Other pieces of a Kubernetes cluster

Nodes:
These machines perform the requested tasks assigned by the control plane.

Pod:
A set of 1 or more containers deployed to a single node. A pod is the smallest and simplest Kubernetes object.

Service:
A way to expose an application running on a set of pods as a network service. This decouples work definitions from the pods.

Kubectl:
The command line interface where you can manage your Kubernetes cluster. Learn basic kubectl and Helm commands for beginners.

kubelet:
A tiny application located within each node that communicates with the control plane. The kublet makes sure containers are running in a pod.

If you’re ready to get started with Kubernetes for yourself, Minikube is an open source tool that allows you to set up a local Kubernetes cluster so you can try out Kubernetes from a laptop.

 

How Kubernetes works 

Kubernetes works based on defined state and actual state. Kubernetes objects represent the state of a cluster and tell Kubernetes what you want the workload to look like.

Once an object has been created and defined, Kubernetes works to make sure that the object always exists. 

Controllers actively manage the state of Kubernetes objects and work to make changes that move the cluster from its current state to the desired state. 

Developers or sysadmins specify the defined state using the YAML or JSON files they submit to the Kubernetes API. Kubernetes uses a controller to analyze the difference between the new defined state and the actual state in the cluster.

The desired state of a Kubernetes cluster defines which applications or other workloads should be running, along with which container images they use, which resources should be made available to them, and other configuration details.

Configuration data and information about the state of the cluster lives in etcd, a key-value store database. Fault-tolerant and distributed, etcd is designed to be the ultimate source of truth about your cluster.

Kubernetes will automatically manage your cluster to match the desired state. Controllers usually do this by sending messages to the API server that result in the needed changes, and some Kubernetes resources have built-in controllers.

As an example of how Kubernetes manages desired state, suppose you deploy an application with a desired state of "3," meaning 3 replicas of the application should be running.

If 1 of those containers crashes, the Kubernetes replica set will see that only 2 replicas are running, so it will add 1 more to satisfy the desired state.

Replica sets are a type of controller that ensures a specified number of pods are running at any given time.

Kubernetes deployments are the preferred method for managing replica sets and provide declarative updates to pods so that you don’t have to manually manage them yourself. 

You can also use autoscaling in Kubernetes to manage the scale of your services based on user demand. When specifying the desired state of an application or service, you can also tell the controller to make additional pods available if demand increases.

For example, during a busy time period your application's desired state could increase to 10, instead of the usual 3 replicas.

 

Kubernetes deployments

A Kubernetes deployment is a resource object in Kubernetes that provides declarative updates to applications.

A deployment allows you to describe an application’s life cycle, such as which images to use for the app, the number of pods there should be, and the way in which they should be updated. 

The process of manually updating containerized applications can be time consuming and tedious. A Kubernetes deployment makes this process automated and repeatable. 

Deployments are entirely managed by the Kubernetes backend, and the whole update process is performed on the server side without client interaction.

The Kubernetes deployment object lets you:

  • Deploy a replica set or pod
  • Update pods and replica sets
  • Rollback to previous deployment versions
  • Scale a deployment
  • Pause or continue a deployment

 

Kubernetes patterns

Kubernetes patterns are design patterns for container-based applications and services.  

Kubernetes can help developers write cloud-native apps, and it provides a library of application programming interfaces (APIs) and tools for building applications. 

However, Kubernetes doesn’t provide developers and architects with guidelines for how to use these pieces to build a complete system that meets business needs and goals. 

Patterns are a way to reuse architectures. Instead of completely creating the architecture yourself, you can use existing Kubernetes patterns, which also ensure that things will work the way they’re supposed to.

Patterns are the tools needed by a Kubernetes developer, and they will show you how to build your system.

 

Kubernetes operators 

A Kubernetes operator is a method of packaging, deploying, and managing a Kubernetes application. A Kubernetes application is both deployed on Kubernetes and managed using the Kubernetes API and kubectl tooling.

A Kubernetes operator is an application-specific controller that extends the functionality of the Kubernetes API to create, configure, and manage instances of complex applications on behalf of a Kubernetes user.

Learn how to build a Kubernetes operator in 10 minutes using the Operator SDK.

It builds upon the basic Kubernetes resource and controller concepts, but includes domain or application-specific knowledge to automate the entire life cycle of the software it manages.

If you want more detail on Kubernetes operators and why they’re important here’s how to explain them in plain English. 

Operators allow you to write code to automate a task, beyond the basic automation features provided in Kubernetes. For teams following a DevOps or site reliability engineering (SRE) approach, operators were developed to put SRE practices into Kubernetes. 

Learn more about how Kubernetes operators work, including real examples, and how to build them with the Operator Framework and software development kit.

 

Support DevOps with Kubernetes

DevOps relies on automating routine operational tasks and standardizing environments across an app’s lifecycle.

Containers support a unified environment for development, delivery, and automation, and make it easier to move apps between development, testing, and production environments.

A major outcome of implementing DevOps is a continuous integration and continuous deployment pipeline (CI/CD). CI/CD helps you deliver apps to customers frequently and validate software quality with minimal human intervention.

Managing the lifecycle of containers with Kubernetes using Kubernetes deployments and operators alongside a DevOps approach helps to align software development and IT operations to support a CI/CD pipeline.

 

Get trained in Kubernetes

Deploying Containerized Applications Tech Overview 

This on-demand series of short lectures and in-depth demonstrations introduces you to Linux containers and container orchestration technology using Docker, Kubernetes, and Red Hat® OpenShift® Container Platform.

 

Red Hat OpenShift Administration 

This course teaches you how to install and administer the Red Hat OpenShift Container Platform. This hands-on, lab-based course shows you how to install, configure, and manage OpenShift clusters and deploy sample applications to further understand how developers will use the platform.

 

Introduction to OpenShift Applications

This course is a developer-focused introduction to Red Hat OpenShift application building, deployment, scaling, and troubleshooting. As OpenShift and Kubernetes continue to become widely adopted, developers are increasingly required to understand how to develop, build, and deploy applications with a containerized application platform.

 

Kubernetes for the enterprise 

Red Hat OpenShift is Kubernetes for the enterprise. It includes all of the extra pieces of technology that make Kubernetes powerful and viable for the enterprise, including registry, networking, telemetry, security, automation, and services.

With Red Hat OpenShift, developers can make new containerized apps, host them, and deploy them in the cloud with the scalability, control, and orchestration that can turn a good idea into new business quickly and easily.

You can try using Red Hat OpenShift to automate your container operations with a free 60-day evaluation.

The tools you need to get started with Kubernetes

Red Hat OpenShift product logo

Develop, deploy, and manage your containers with enterprise Kubernetes—anywhere, at any scale.

Control Kubernetes clusters and applications from a single console, with built-in security policies. 

There's a lot more to do with Kubernetes