A Beginner's Guide to Kubernetes (Part 1): Introduction
Join the DZone community and get the full member experience.Join For Free
Kubernetes, often referred to as k8s, is an open source container orchestration system that helps deploy and manage containerized applications. Developed by Google starting in 2014 and written in the Go language, Kubernetes is quickly becoming the standard way to architect horizontally scalable applications.
In this guide you will learn about containers and orchestration, the Kubernetes API, and kubectl.
Already know containerization basics? Skip ahead to Kubernetes for Beginners Part 2: Master, Nodes, and the Control Plane
Kubernetes is a container orchestration tool and, therefore, needs a container runtime installed to work.
In practice, the default container runtime for Kubernetes is Docker, though other runtimes like rkt, and LXD will also work. With the advent of the Container Runtime Interface (CRI), which hopes to standardize the way Kubernetes interacts with containers, other options like containerd, cri-o, and Frakti have also become available. The guides in this series assume you have a working knowledge of containers and the examples will all use Docker as the container runtime.
Containers are similar to virtual machines. They are light-weight isolated runtimes that share resources of the operating system without having to run a full operating system themselves. Containers consume few resources but contain a complete set of information needed to execute their contained application images such as files, environment variables, and libraries.
Containerization is a virtualization method to run distributed applications in containers using microservices. Containerizing an application requires a base image that can be used to create an instance of a container. Once an application’s image exists, you can push it to a centralized container registry that Kubernetes can use to deploy container instances in a cluster’s pods, which you will learn more about in Beginner’s Guide to Kubernetes: Objects.
Orchestration is the automated configuration, coordination, and management of computer systems, software, middleware, and services. It takes advantage of automated tasks to execute processes. For Kubernetes, container orchestration automates all the provisioning, deployment, and availability of containers; load balancing; resource allocation between containers; and health monitoring of the cluster.
Kubernetes is built around a robust RESTful API. Every action taken in Kubernetes, be it inter-component communication or user command, interacts in some fashion with the Kubernetes API. The goal of the API is to help facilitate the desired state of the Kubernetes cluster.
The Kubernetes API is a “declarative model”, meaning that it focuses on the what, not the how. You tell it what you want to accomplish and it does it. This might involve creating or destroying resources but you don’t have to worry about those details. To create this desired state, you create objects, which are normally represented by YAML files called manifests, and apply them through the command line with the kubectl tool.
kubectl is a command line tool used to interact with the Kubernetes cluster. It offers a host of features, including the ability to create, stop, and delete resources; describe active resources; and auto scale resources.
For more information on the types of commands and resources you can use with kubectl, consult the Kubernetes kubectl documentation.
To continue in the Beginner’s Guide to Kubernetes series, visit part 2:
Published at DZone with permission of Heather Zoppetti. See the original article here.
Opinions expressed by DZone contributors are their own.