- Topics
- Containers
- Learning Kubernetes basics
Learning Kubernetes basics
Overview
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 publiccloud providers like Amazon Web Services (AWS),Google Cloud,IBM Cloud, andMicrosoft Azure.
Kubernetes architecture
Kubernetes gives you the platform to schedule and run containers on clusters of physical orvirtual machines. Kubernetes architecture divides a cluster into components that work together to maintain the cluster's defined state.
AKubernetes 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 ownLinux® environment, and could be either a physical or virtual machine. Each node runs pods, which are made up of containers.
TheKubernetes 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.
Red Hat resources
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. Learnbasic 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 theYAML 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
AKubernetes 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 tobuild 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 importanthere’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 orsite 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.
Training & administration
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 official Red Hat blog
Get the latest information about our ecosystem of customers, partners, and communities.
All Red Hat product trials
Keep reading
What is a Linux container?
What is container orchestration?
What is Kubernetes?
Containers resources
Related content
Related articles
- What is a Linux container?
- What is container orchestration?
- Stateful vs stateless applications
- What is Kubernetes?
- Red Hat OpenShift on VMware
- What is KubeVirt?
- Why use Red Hat Ansible Automation Platform with Red Hat OpenShift?
- What is Podman Desktop?
- What is Podman?
- What is the Kubernetes Java client?
- What are hosted control planes?
- What is kubernetes security?
- Red Hat OpenShift for developers
- Containers vs VMs
- Edge computing with Red Hat OpenShift
- How Kubernetes can help AI/ML
- What is Kubeflow?
- What are microservices?
- OpenShift vs. OpenStack: What are the differences?
- What is container security?
- What are sandboxed containers
- what is Buildah?
- Kubernetes vs OpenStack
- What are validated patterns?
- Kubernetes on AWS: Self-Managed vs. Managed Applications Platforms
- What is an image builder?
- Red Hat OpenShift vs. OKD
- Red Hat OpenShift vs. Kubernetes: What's the difference?
- Why run Apache Kafka on Kubernetes?
- Spring on Kubernetes with Red Hat OpenShift
- What is high availability and disaster recovery for containers?
- What is a golden image?
- What are Red Hat OpenShift cloud services?
- VNF and CNF, what’s the difference?
- What is a container registry?
- What is Skopeo?
- What are Red Hat OpenShift Operators?
- Using Helm with Red Hat OpenShift
- Kubernetes security best practices
- Orchestrating Windows containers on Red Hat OpenShift
- What is a Kubernetes operator?
- High performance computing with Red Hat OpenShift
- Advantages of Kubernetes-native security
- What is KubeLinter?
- Intro to Kubernetes security
- Container and Kubernetes compliance considerations
- How microservices support IT integration in healthcare
- Kubernetes cluster management
- Red Hat OpenShift on IBM IT infrastructure
- Red Hat OpenShift for business leaders
- How to deploy Red Hat OpenShift
- Cost management for Kubernetes on Red Hat OpenShift
- What is enterprise Kubernetes?
- What makes Red Hat OpenShift the right choice for IT operations?
- What makes Red Hat OpenShift the right choice for SAP?
- Why choose Red Hat for Kubernetes?
- Kubernetes-native Java development with Quarkus
- What is Kubernetes role-based access control (RBAC)
- What is containerization?
- What was CoreOS and CoreOS container Linux
- What is service-oriented architecture?
- What is the Kubernetes API?
- What is Kubernetes cluster management?
- What is a Kubernetes deployment?
- Why choose the Red Hat build of Quarkus?
- Introduction to Kubernetes architecture
- What is CaaS?
- Introduction to Kubernetes patterns
- What is a Kubernetes cluster?
- What is Quarkus?
- What is Jaeger?
- What is Clair?
- What is Knative?
- What is etcd?
- What is container-native virtualization?
- Why choose Red Hat for microservices?
- Why choose Red Hat for containers?
- What is Docker?
- What is a Kubernetes pod?