Cloud Native 12 min read

Master Kubernetes Basics and Build Your First Cluster Step‑by‑Step

This article introduces Kubernetes fundamentals, explains core concepts such as containers, clusters, pods, services, and labels, and provides a detailed, step‑by‑step guide for setting up a simple Kubernetes cluster on Ubuntu using VirtualBox and Vagrant.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Master Kubernetes Basics and Build Your First Cluster Step‑by‑Step

What is Kubernetes

Kubernetes is an open‑source container cluster management tool released by Google. It orchestrates Docker containers across a set of machines, providing lightweight, efficient, and isolated environments.

Container : Uses Linux namespaces and cgroups to create isolated, lightweight environments, offering many of the benefits of virtual machines with far lower resource overhead.

Cluster : A group of computers working together to perform the same tasks; if one node fails, others continue, offering high availability and scalability.

Kubernetes Features

The cluster follows a master‑slave architecture. Each cluster has one Master node and multiple Minion (worker) nodes. Users access services provided by the Minions, while administrators control the cluster via the Master.

Each Minion runs one or more Pods, which are the basic deployment units containing one or more containers. Key components on a Minion include Kubelet (monitors pod health) and Proxy (provides a unified access address).

Pod : The smallest deployable unit; can host multiple containers that share namespaces.

Kubelet : Ensures containers inside a Pod are running; recreates them if they crash.

Proxy : Acts as a simple load‑balancer, exposing a single virtual IP for the set of Pods.

Key Kubernetes Concepts

Clusters : Lists supported operating systems and IaaS platforms (illustrated in the image below).

Pods : Built from Linux namespaces (PID, UTS, network, IPC). Pods share these namespaces, enabling resource sharing and communication.

Resource sharing and communication

Simplified management

Vertical integration of application stacks

Replication Controller : Guarantees a desired number of Pod replicas, handling rescheduling, scaling, rolling updates, and version tracking.

Services : Logical abstraction of a set of Pods, providing a stable endpoint (virtual IP) and load‑balancing via a Proxy.

Label : Key‑value pairs attached to objects (e.g., Pods) to organize and select resources; supports equality‑based and set‑based selectors.

Building a Kubernetes Cluster

The author set up a simple cluster on an Ubuntu 14.04 laptop using VirtualBox, CentOS 7 VMs, and Vagrant. Two deployment patterns were tried: master and etcd on the same machine, and master/etcd on separate machines.

Configuration plan (IP addresses):

Node      | IP               | Role
master    | 10.100.199.165   | kubernetes
minion1   | 10.100.199.201   | kubernetes docker
etcd      | 10.100.199.10    | etcd

On each host, the /etc/hosts file was updated accordingly (examples omitted for brevity).

Key steps on the master node:

# Add virt7‑testing repository
[virt7-testing]
name=virt7-testing
baseurl=http://cbs.centos.org/repos/virt7-testing/x86_64/os/
enable=1
gpgcheck=0

# Install Kubernetes
yum -y install kubernetes

# Verify installation
kubectl version

After installation, the master runs apiserver, scheduler, and controller‑manager. Example configuration snippets:

KUBE_ETCD_SERVICES="--etcd_servers=http://etcdSer:4001"
KUBE_API_ADDRESS="--address=0.0.0.0"
KUBE_MASTER="--master=http://master:8080"
KUBE_ETCD_SERVERS="--etcd_servers=http://etcdSer:4001"
KUBELET_ADDRESSES="--machines=minion1"

Firewalls were disabled before starting services:

systemctl disable iptables-services firewalld
systemctl stop iptables-services firewalld

Start and enable core services:

for SERVICE in kube-apiserver kube-controller-manager kube-scheduler; do
  systemctl restart $SERVICE
  systemctl enable $SERVICE
  systemctl status $SERVICE
done

Minion configuration mirrors the master: add the same repository, install Kubernetes (Docker is pre‑installed), configure KUBELET_ADDRESS and KUBELET_HOSTNAME, disable firewalls, and start kubelet, kube-proxy, and docker services.

Etcd node: install etcd version 0.4.6 from a specific repository and disable firewalls.

Verification on the master:

kubectl version
kubectl get minions

Successful output confirms the cluster is operational.

References

Kubernetes GitHub homepage.

Source: http://www.mworks92.com/2015/06/04/kubernetes/
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Cloud NativeDevOpscontainer orchestrationCluster Setup
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.