Giter Site home page Giter Site logo

kubernetes's Introduction

Kubernetes Installation on Debian

This script automates the installation of Kubernetes on Debian and Debian-based distributions. It also installs Docker, disables swap, and configures the necessary Kubernetes repositories.

Prerequisites

  • Debian 10 or newer / Kali Linux
  • sudo access

Steps

  1. Update Package Lists and Install Dependencies:

    The script will update your package lists and install the required dependencies.

  2. Install Docker:

    Docker is required to run Kubernetes containers. The script will add the Docker repository and install Docker.

  3. Disable Swap:

    Kubernetes requires swap to be disabled. The script will disable swap and update the fstab file to ensure swap remains off after a reboot.

  4. Install Kubernetes:

    The script will add the Kubernetes repository and install kubelet, kubeadm, and kubectl.

  5. Initialize Kubernetes:

    After installing Kubernetes, the script will run kubeadm init to initialize the Kubernetes cluster.

  6. Configure Kubeconfig:

    The script will set up the kubeconfig file so you can access your Kubernetes cluster.

Script

Copy and run the following script to automate the installation process:

#!/bin/bash

# Update package lists
sudo apt update

# Install dependencies
sudo apt install -y apt-transport-https ca-certificates gnupg2 curl software-properties-common libssl-dev

# Add Docker repository
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"

# For Kali Linux
# sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian bullseye stable"

# Update package lists
sudo apt update

# Install Docker
sudo apt install -y docker-ce
# sudo systemctl status docker

# Disable swap
sudo swapoff -a
sudo sed -i '/ swap / s/^/#/' /etc/fstab

# Add Kubernetes repository
sudo mkdir -p -m 755 /etc/apt/keyrings
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.30/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
sudo chmod 644 /etc/apt/keyrings/kubernetes-apt-keyring.gpg
echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.30/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo chmod 644 /etc/apt/sources.list.d/kubernetes.list

# Update package lists
sudo apt update

# Install Kubernetes
sudo apt install -y kubelet kubeadm kubectl

# Remove containerd configuration
sudo rm -rf /etc/containerd/config.toml
sudo systemctl restart containerd

# Initialize Kubernetes cluster
sudo kubeadm init

# Set up kubeconfig
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config

Notes

  • Ensure to check the latest versions of Kubernetes and Docker to use versions that fit your requirements.
  • After initializing Kubernetes, you may need to install a CNI network plugin and configure worker nodes.

If you have any questions or issues, feel free to contact us.


kubernetes's People

Contributors

febrd avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.