Kubernetes, often abbreviated as K8s, is an open-source platform designed to automate deploying, scaling, and operating application containers. It was originally developed by Google and is now maintained by the Cloud Native Computing Foundation (CNCF). Kubernetes provides a robust framework for managing containerized applications across multiple hosts, offering features like self-healing, load balancing, and automated rollouts and rollbacks.
The smallest deployable units in Kubernetes are Pods. A Pod is a group of one or more containers that share storage and network resources. Containers within the same Pod can communicate with each other over localhost.
Let's create a simple Pod running an Nginx container.
NAME READY STATUS RESTARTS AGE nginx 1/1 Running 0 1m
A Deployment manages a set of identical Pods and ensures that the desired number of replicas are running at any given time. It provides declarative updates for Pods and ReplicaSets.
Let's create a Deployment to manage our Nginx Pod.
NAME READY UP-TO-DATE AVAILABLE AGE nginx-deployment 1/1 1 1 1m
A Service in Kubernetes is an abstraction that defines a logical set of Pods and a policy by which to access them. Services enable a loose coupling between dependent Pods.
Let's create a Service to expose our Nginx Deployment.
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE nginx-deployment LoadBalancer 10.96.0.1 <pending> 80:31234/TCP 1m
A Namespace in Kubernetes is a virtual cluster that provides a way to divide cluster resources between multiple users or projects. Each Namespace operates with its own set of rules and policies.
Let's create a new Namespace called dev.
NAME STATUS AGE default Active 1d kube-system Active 1d kube-public Active 1d kube-node-lease Active 1d dev Active 1m
Now that you have a basic understanding of Kubernetes and its core concepts, the next step is to explore the architecture of Kubernetes in more detail. Understanding how different components interact will help you manage and scale your applications effectively.
In the next section, we'll dive into the architecture of Kubernetes, covering key components like the Control Plane, Nodes, and etcd. This knowledge will provide a solid foundation for advanced Kubernetes operations and troubleshooting.
Stay tuned!