βΈοΈ Kubernetes: Introduction Tutorial
Welcome to the Kubernetes introduction tutorial! Kubernetes is a powerful open-source platform designed to automate the deployment, scaling, and management of containerized applications. In this guide, we'll cover the fundamentals of Kubernetes, including its key features, installation, and basic commands to help you get started.
π Table of Contents
- What is Kubernetes?
- Key Features
- Installation
- Basic Commands
- Getting Started with Kubernetes
- Further Reading
π€ What is Kubernetes?
Kubernetes (often abbreviated as K8s) is an open-source container orchestration platform that simplifies the management of containerized applications across clusters of machines. It automates many tasks involved in deploying and managing applications, including scaling, load balancing, and failover.
π Key Features
- Automated Scaling: Adjusts the number of running containers based on demand.
- Self-Healing: Replaces failed containers and restarts them as necessary.
- Service Discovery and Load Balancing: Automatically exposes services and manages load balancing.
- Storage Orchestration: Manages storage resources for containers, allowing them to use storage solutions easily.
π οΈ Installation
For Linux (Using Minikube)
- Install Minikube:
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube
- Start Minikube:
- Verify Kubernetes Cluster:
For Windows/Mac
- Download and install Minikube from the Minikube GitHub releases page.
- Follow the installation instructions specific to your operating system.
π» Basic Commands
- Check Cluster Information:
- List Nodes in the Cluster:
- Create a Deployment:
- Expose a Deployment:
- View Pods:
- View Services:
π Getting Started with Kubernetes
- Create a Deployment YAML File: A Deployment YAML file defines a set of Pods and the desired state of the application. Hereβs an example:
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app
spec:
replicas: 3
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app
spec:
containers:
- name: my-app-container
image: nginx
ports:
- containerPort: 80
- Apply the Deployment:
- Scale the Deployment:
- Delete the Deployment: