apex
packer
vb
::
=>
riot
torch
composer
apex
+
+
js
graphql
vb
vault
+
+
saml
choo
>=
+
d
_
gitlab
+
atom
+
+
actix
+
smtp
+
+
rider
sails
r
backbone
groovy
hugging
wasm
+
bbedit
xcode
+
gatsby
+
+
+
parcel
+
groovy
+
+
tcl
+
+=
+
istio
+
π
+
+
pinecone
!
aws
+
cargo
+
nest
angular
istio
rider
next
+
+
+
gulp
cobol
+
+
sklearn
echo
+
nim
gh
+
+
+
pip
+
Back to Blog
☸️ Kubernetes Installation Complete Guide on AlmaLinux
kubernetes k8s almalinux

☸️ Kubernetes Installation Complete Guide on AlmaLinux

Published Sep 14, 2025

Master Kubernetes installation on AlmaLinux! Complete K8s setup guide with kubectl, minikube, and production cluster deployment. Perfect for DevOps engineers and cloud architects.

18 min read
0 views
Table of Contents

☸️ Kubernetes Installation Complete Guide on AlmaLinux

Ready to orchestrate containers like a maestro? 🎭 Kubernetes (K8s) is the industry standard for container orchestration, powering the world’s largest applications! In this comprehensive guide, we’ll install Kubernetes on AlmaLinux and deploy your first applications. Let’s master the cloud-native revolution! 🚀

🤔 Why is Kubernetes Important?

Kubernetes is the operating system of the cloud! ☁️ Here’s why it dominates:

  • 🚀 Industry Standard: 92% of companies use Kubernetes
  • 💼 High-Paying Jobs: K8s engineers earn $140k+ annually
  • 📈 Infinite Scalability: Scale from 1 to 10,000+ containers
  • 🔄 Self-Healing: Automatically replaces failed containers
  • 🌍 Cloud Agnostic: Works on AWS, Azure, GCP, on-premise
  • 🎯 Zero Downtime: Rolling updates without service interruption
  • 💰 Cost Optimization: Efficient resource utilization
  • 🔧 DevOps Essential: Core skill for modern infrastructure

Kubernetes literally runs Netflix, Spotify, Uber, and more! 🌟

🎯 What You Need

Let’s prepare for Kubernetes mastery! ✅

  • ✅ AlmaLinux 8 or 9 (minimum 2 nodes for cluster)
  • ✅ At least 4GB RAM per node (8GB recommended)
  • ✅ 2 CPUs per node minimum
  • ✅ 20GB free disk space
  • ✅ Root or sudo access
  • ✅ Network connectivity between nodes
  • ✅ Docker or containerd installed
  • ✅ 30 minutes for setup
  • ✅ Excitement for cloud-native tech! 🎉

Let’s build your Kubernetes cluster! 🌟

📝 Step 1: Prepare System for Kubernetes

First, let’s configure AlmaLinux for K8s! 🎯

# Disable swap (Kubernetes requirement)
sudo swapoff -a
sudo sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab

# Disable SELinux (or set to permissive)
sudo setenforce 0
sudo sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config

# Configure kernel modules
cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf
overlay
br_netfilter
EOF

sudo modprobe overlay
sudo modprobe br_netfilter

# Configure sysctl for Kubernetes
cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-iptables  = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.ipv4.ip_forward                 = 1
EOF

sudo sysctl --system

# Update system packages
sudo dnf update -y

Perfect! 🎉 System is ready for Kubernetes!

🔧 Step 2: Install Container Runtime (containerd)

Kubernetes needs a container runtime. Let’s install containerd! 🐳

# Install containerd
sudo dnf install -y containerd.io

# Configure containerd
sudo mkdir -p /etc/containerd
sudo containerd config default | sudo tee /etc/containerd/config.toml

# Enable SystemdCgroup
sudo sed -i 's/SystemdCgroup = false/SystemdCgroup = true/g' /etc/containerd/config.toml

# Start and enable containerd
sudo systemctl restart containerd
sudo systemctl enable containerd

# Verify containerd is running
sudo systemctl status containerd

Excellent! 🚀 Container runtime is ready!

🌟 Step 3: Install Kubernetes Components

Time to install kubeadm, kubelet, and kubectl! ⚙️

# Add Kubernetes repository
cat <<EOF | sudo tee /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-\$basearch
enabled=1
gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
exclude=kubelet kubeadm kubectl
EOF

# Install Kubernetes components
sudo dnf install -y kubelet kubeadm kubectl --disableexcludes=kubernetes

# Enable kubelet service
sudo systemctl enable --now kubelet

# Check versions
kubectl version --client
kubeadm version

Amazing! 🎯 Kubernetes tools are installed!

✅ Step 4: Initialize Kubernetes Master Node

Let’s create your Kubernetes cluster! 🏗️

# Initialize master node (run on master only)
sudo kubeadm init --pod-network-cidr=10.244.0.0/16

# Configure kubectl for your user
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config

# Verify cluster status
kubectl cluster-info
kubectl get nodes

Save the join command output! You’ll need it for worker nodes:

kubeadm join <master-ip>:6443 --token <token> --discovery-token-ca-cert-hash sha256:<hash>

Fantastic! 🎉 Master node is ready!

🔧 Step 5: Install Pod Network Add-on

Kubernetes needs a network plugin for pod communication! 🌐

# Install Flannel network plugin
kubectl apply -f https://raw.githubusercontent.com/flannel-io/flannel/master/Documentation/kube-flannel.yml

# Or install Calico (alternative)
kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.26.0/manifests/tigera-operator.yaml
kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.26.0/manifests/custom-resources.yaml

# Verify network pods are running
kubectl get pods -n kube-system

Perfect! ⚡ Network is configured!

🌟 Step 6: Join Worker Nodes (Multi-Node Setup)

On each worker node, join the cluster! 👥

# On worker nodes, run the join command from master init
sudo kubeadm join <master-ip>:6443 --token <token> \
    --discovery-token-ca-cert-hash sha256:<hash>

# On master, verify nodes joined
kubectl get nodes

# Label worker nodes
kubectl label node <worker-node-name> node-role.kubernetes.io/worker=worker

✅ Step 7: Deploy Your First Application

Let’s deploy a real application on Kubernetes! 🚀

Deploy Nginx Application

# Create deployment
kubectl create deployment nginx-app --image=nginx:latest --replicas=3

# Expose deployment as service
kubectl expose deployment nginx-app --port=80 --type=NodePort

# Check deployment status
kubectl get deployments
kubectl get pods
kubectl get services

# Scale the deployment
kubectl scale deployment nginx-app --replicas=5

# Get service URL
kubectl get svc nginx-app

Deploy WordPress with MySQL

# Create namespace
kubectl create namespace wordpress

# Deploy MySQL
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Secret
metadata:
  name: mysql-pass
  namespace: wordpress
type: Opaque
data:
  password: V29yZFByZXNzUGFzcw==  # Base64 encoded password
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: wordpress-mysql
  namespace: wordpress
spec:
  selector:
    matchLabels:
      app: wordpress
      tier: mysql
  template:
    metadata:
      labels:
        app: wordpress
        tier: mysql
    spec:
      containers:
      - image: mysql:8.0
        name: mysql
        env:
        - name: MYSQL_ROOT_PASSWORD
          valueFrom:
            secretKeyRef:
              name: mysql-pass
              key: password
        - name: MYSQL_DATABASE
          value: wordpress
        ports:
        - containerPort: 3306
          name: mysql
---
apiVersion: v1
kind: Service
metadata:
  name: wordpress-mysql
  namespace: wordpress
spec:
  ports:
    - port: 3306
  selector:
    app: wordpress
    tier: mysql
EOF

# Deploy WordPress
cat <<EOF | kubectl apply -f -
apiVersion: apps/v1
kind: Deployment
metadata:
  name: wordpress
  namespace: wordpress
spec:
  replicas: 2
  selector:
    matchLabels:
      app: wordpress
      tier: frontend
  template:
    metadata:
      labels:
        app: wordpress
        tier: frontend
    spec:
      containers:
      - image: wordpress:latest
        name: wordpress
        env:
        - name: WORDPRESS_DB_HOST
          value: wordpress-mysql
        - name: WORDPRESS_DB_PASSWORD
          valueFrom:
            secretKeyRef:
              name: mysql-pass
              key: password
        ports:
        - containerPort: 80
          name: wordpress
---
apiVersion: v1
kind: Service
metadata:
  name: wordpress
  namespace: wordpress
spec:
  type: LoadBalancer
  ports:
    - port: 80
  selector:
    app: wordpress
    tier: frontend
EOF

# Check WordPress deployment
kubectl get all -n wordpress

🔧 Step 8: Install Kubernetes Dashboard

Get a visual interface for your cluster! 📊

# Deploy Dashboard
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml

# Create admin user for dashboard
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: ServiceAccount
metadata:
  name: admin-user
  namespace: kubernetes-dashboard
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: admin-user
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin
subjects:
- kind: ServiceAccount
  name: admin-user
  namespace: kubernetes-dashboard
EOF

# Get access token
kubectl -n kubernetes-dashboard create token admin-user

# Start proxy to access dashboard
kubectl proxy

# Access dashboard at:
# http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/

🌟 Step 9: Install Helm Package Manager

Helm is the package manager for Kubernetes! 📦

# Download and install Helm
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh

# Add popular Helm repositories
helm repo add stable https://charts.helm.sh/stable
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update

# Install an application using Helm
helm install my-redis bitnami/redis --namespace redis --create-namespace

# List Helm releases
helm list --all-namespaces

🎮 Quick Examples

Practice Kubernetes with real deployments! 🎯

Example 1: Microservices Application

# microservices-app.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: frontend
spec:
  replicas: 3
  selector:
    matchLabels:
      app: frontend
  template:
    metadata:
      labels:
        app: frontend
    spec:
      containers:
      - name: frontend
        image: nginx:alpine
        ports:
        - containerPort: 80
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: backend-api
spec:
  replicas: 2
  selector:
    matchLabels:
      app: backend
  template:
    metadata:
      labels:
        app: backend
    spec:
      containers:
      - name: api
        image: node:16-alpine
        command: ["node", "server.js"]
        ports:
        - containerPort: 3000

Example 2: StatefulSet for Database

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: postgres
spec:
  serviceName: "postgres"
  replicas: 1
  selector:
    matchLabels:
      app: postgres
  template:
    metadata:
      labels:
        app: postgres
    spec:
      containers:
      - name: postgres
        image: postgres:14
        env:
        - name: POSTGRES_DB
          value: myapp
        - name: POSTGRES_PASSWORD
          value: mysecretpassword
        volumeMounts:
        - name: postgres-storage
          mountPath: /var/lib/postgresql/data
  volumeClaimTemplates:
  - metadata:
      name: postgres-storage
    spec:
      accessModes: ["ReadWriteOnce"]
      resources:
        requests:
          storage: 10Gi

Example 3: Ingress Controller

# Install NGINX Ingress Controller
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.8.2/deploy/static/provider/cloud/deploy.yaml

# Create Ingress resource
cat <<EOF | kubectl apply -f -
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: my-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
  - host: myapp.example.com
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: nginx-app
            port:
              number: 80
EOF

🚨 Fix Common Problems

Kubernetes troubleshooting guide! 🔧

Problem 1: Nodes Not Ready

Solution:

# Check node status
kubectl describe node <node-name>

# Check kubelet logs
sudo journalctl -u kubelet -f

# Restart kubelet
sudo systemctl restart kubelet

Problem 2: Pods Stuck in Pending

Solution:

# Check pod events
kubectl describe pod <pod-name>

# Check resource availability
kubectl top nodes
kubectl top pods

# Check for PVC issues
kubectl get pvc

Problem 3: Network Issues

Solution:

# Check network plugin
kubectl get pods -n kube-system | grep -E "(flannel|calico|weave)"

# Restart network pods
kubectl delete pods -n kube-system -l app=flannel

# Check DNS
kubectl run -it --rm debug --image=busybox --restart=Never -- nslookup kubernetes

📋 Simple Commands Summary

CommandPurpose
kubectl get nodesList cluster nodes
kubectl get podsList pods
kubectl get svcList services
kubectl apply -f file.yamlDeploy from YAML
kubectl delete -f file.yamlDelete resources
kubectl logs pod-nameView pod logs
kubectl exec -it pod-name -- bashEnter pod shell
kubectl scale deployment app --replicas=5Scale deployment
kubectl rollout status deployment/appCheck rollout status
kubectl port-forward pod-name 8080:80Forward ports

💡 Tips for Success

Master Kubernetes with these pro tips! 🌟

  • 📚 Learn YAML: Master Kubernetes manifests
  • 🔒 Security First: Use RBAC and network policies
  • 📊 Monitor Everything: Use Prometheus and Grafana
  • 🎯 Start Small: Single node with Minikube first
  • 🔧 Use Namespaces: Organize resources logically
  • 📝 Label Everything: Use labels for organization
  • 🚀 GitOps: Store configs in Git
  • 🤝 Join Communities: CNCF Slack, Reddit r/kubernetes
  • 📈 Practice CKA: Get Kubernetes certification
  • 🌟 Keep Learning: K8s evolves rapidly

🏆 What You Learned

Congratulations! You’re now a Kubernetes operator! 🎉

  • ✅ Installed Kubernetes on AlmaLinux
  • ✅ Configured master and worker nodes
  • ✅ Deployed applications with kubectl
  • ✅ Set up networking and storage
  • ✅ Installed Dashboard and Helm
  • ✅ Created multi-tier applications
  • ✅ Learned troubleshooting techniques
  • ✅ Mastered container orchestration
  • ✅ Gained $140k+ valued skills

🎯 Why This Matters

Your Kubernetes skills are game-changing! 🚀

  • 💼 Career: K8s engineers are highest paid in DevOps
  • ☁️ Cloud Native: Build modern applications
  • 📈 Scalability: Handle millions of users
  • 🔄 Automation: Self-healing infrastructure
  • 🌍 Industry Standard: Used by all major companies
  • 🎯 Future Proof: Essential for cloud architecture

You’ve just mastered the technology running the modern internet! 🏆

Happy orchestrating! 🙌