Welcome to the Linux Foundation Forum!

3.1 Install Kubernetes

Options
mleager
mleager Posts: 2
edited January 9 in LFS258 Class Forum

Good afternoon.

I have a quick question regarding the instructions for installing Kubernetes.

I downloaded and unzipped the course tarball and I think I confused myself when looking at some of the files.

For example, the file ../SOLUTIONS/s_03/containerd-setup.txt

It has similar, yet differing commands to be run to install containerd.
Such as downloading the Keys and installing containerd, but using different filenames.
( /etc/sysctl.d/kubernetes.conf vs. /etc/sysctl.d/99-kubernetes-cri.conf)

Should I just ignore this, and follow the instructions from the 3.1 Lab?
I'm pretty sure they're doing the same thing but I don't want to assume that out of ignorance.

  • NOTE: I'm just using minikube but I was going to install on an AWS EC2 for practice

Section from ../SOLUTIONS/s_03/containerd-setup.txt:

cat <<EOF | sudo tee /etc/modules-load.d/containerd.conf
overlay
br_netfilter
EOF


# Disable swap if not on a cloud instance - done anyway

sudo swapoff -a


# Load the modules now

sudo modprobe overlay

sudo modprobe br_netfilter


# Update sysctl to load iptables and ipforwarding

cat <<EOF | sudo tee /etc/sysctl.d/99-kubernetes-cri.conf
net.bridge.bridge-nf-call-iptables  = 1
net.ipv4.ip_forward                 = 1
net.bridge.bridge-nf-call-ip6tables = 1
EOF

sudo sysctl --system


# Install some necessary software  

sudo apt-get update && sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common

# Install the Docker keyring
#  In Ubuntu 20.04, containerd part of local repos. 

sudo apt install containerd -y

#Older OS steps
#curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key --keyring /etc/apt/trusted.gpg.d/docker.gpg add -

# Create a Docker repository
#sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

# Install and configure the containerd package
#sudo apt-get update && sudo apt-get install -y containerd.io
#sudo mkdir -p /etc/containerd
#sudo containerd config default | sudo tee /etc/containerd/config.toml

# Verify the file has the appropriate contents
#cat /etc/containerd/config.toml

Section from 3.1 Lab:

# 10.  Update kernel networking
cat << EOF | tee /etc/sysctl.d/kubernetes.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
EOF

# 11. Changes to be used by current kernel
sysctl --system

# 12.  Install the necessary key for the software to install
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg \
    | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

echo \
    "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] \
    https://download.docker.com/linux/ubuntu \
    $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

# 13. Install the containerd software
apt-get update &&  apt-get install containerd.io -y
containerd config default | tee /etc/containerd/config.toml
sed -e's/SystemdCgroup = false/SystemdCgroup = true/g'-i /etc/containerd/config.toml
systemctl restart containerd

Answers

  • chrispokorni
    chrispokorni Posts: 2,190
    edited January 10
    Options

    Hi @mleager,

    My recommendation is to follow the video demos from the introductory chapter to provision your lab environment and then follow the instructions provided in the pdf lab guide to complete the hands-on exercises.

    Familiarize yourself with the scripts, definition and configuration files from the SOLUTIONS tarball, however, they will be invoked at various stages as you progress through the lab exercises. Some files will be used by the provided hands-on exercises, while others are made available for your review as additional learning material.

    EDIT: Minikube is not a recommended lab environment for this class.

    Regards,
    -Chris

  • mleager
    mleager Posts: 2
    Options

    Thank you @chrispokorni.
    I'll move over to AWS then and just focus on that.

Categories

Upcoming Training