How To Install A Kubernetes Cluster On Centos 7
Installing kubeadm
This page shows how to install the kubeadm toolbox. For information on how to create a cluster with kubeadm once yous have performed this installation process, see the Using kubeadm to Create a Cluster folio.
Before you begin
- A compatible Linux host. The Kubernetes project provides generic instructions for Linux distributions based on Debian and Red Chapeau, and those distributions without a bundle manager.
- 2 GB or more than of RAM per auto (whatever less will go out picayune room for your apps).
- two CPUs or more.
- Total network connectivity between all machines in the cluster (public or private network is fine).
- Unique hostname, MAC address, and product_uuid for every node. See here for more than details.
- Certain ports are open on your machines. Run across here for more details.
- Bandy disabled. You lot MUST disable bandy in lodge for the kubelet to piece of work properly.
Verify the MAC accost and product_uuid are unique for every node
- You tin can get the MAC address of the network interfaces using the command
ip linkorifconfig -a - The product_uuid can be checked by using the command
sudo cat /sys/class/dmi/id/product_uuid
It is very probable that hardware devices will have unique addresses, although some virtual machines may have identical values. Kubernetes uses these values to uniquely place the nodes in the cluster. If these values are not unique to each node, the installation procedure may fail.
Check network adapters
If yous take more ane network adapter, and your Kubernetes components are not reachable on the default route, we recommend you lot add IP road(s) so Kubernetes cluster addresses go via the advisable adapter.
Letting iptables run into bridged traffic
Make sure that the br_netfilter module is loaded. This tin be done by running lsmod | grep br_netfilter. To load information technology explicitly telephone call sudo modprobe br_netfilter.
As a requirement for your Linux Node's iptables to correctly see bridged traffic, you should ensure internet.bridge.span-nf-call-iptables is set to 1 in your sysctl config, e.g.
cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf br_netfilter EOF cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf net.bridge.span-nf-call-ip6tables = one net.span.bridge-nf-phone call-iptables = 1 EOF sudo sysctl --system For more than details please meet the Network Plugin Requirements page.
Check required ports
These required ports need to be open in gild for Kubernetes components to communicate with each other. Yous tin use telnet to bank check if a port is open. For example:
The pod network plugin you apply (see beneath) may also crave certain ports to exist open. Since this differs with each pod network plugin, please see the documentation for the plugins about what port(due south) those demand.
Installing runtime
To run containers in Pods, Kubernetes uses a container runtime.
By default, Kubernetes uses the Container Runtime Interface (CRI) to interface with your chosen container runtime.
If y'all don't specify a runtime, kubeadm automatically tries to detect an installed container runtime by scanning through a list of well known Unix domain sockets. The following table lists container runtimes and their associated socket paths:
| Runtime | Path to Unix domain socket |
|---|---|
| Docker | /var/run/dockershim.sock |
| containerd | /run/containerd/containerd.sock |
| CRI-O | /var/run/crio/crio.sock |
If both Docker and containerd are detected, Docker takes precedence. This is needed because Docker 18.09 ships with containerd and both are detectable fifty-fifty if you lot only installed Docker. If any other two or more than runtimes are detected, kubeadm exits with an error.
The kubelet integrates with Docker through the built-in dockershim CRI implementation.
See container runtimes for more information.
By default, kubeadm uses Docker as the container runtime. The kubelet integrates with Docker through the born dockershim CRI implementation.
See container runtimes for more data.
Installing kubeadm, kubelet and kubectl
You will install these packages on all of your machines:
-
kubeadm: the control to bootstrap the cluster. -
kubelet: the component that runs on all of the machines in your cluster and does things like starting pods and containers. -
kubectl: the control line util to talk to your cluster.
kubeadm will non install or manage kubelet or kubectl for you, so you will need to ensure they match the version of the Kubernetes command plane yous desire kubeadm to install for you. If you do not, there is a run a risk of a version skew occurring that tin can lead to unexpected, buggy behaviour. However, 1 minor version skew between the kubelet and the control plane is supported, merely the kubelet version may never exceed the API server version. For example, the kubelet running 1.7.0 should be fully compatible with a 1.8.0 API server, but non vice versa.
For information about installing kubectl, run into Install and prepare up kubectl.
For more information on version skews, meet:
- Kubernetes version and version-skew policy
- Kubeadm-specific version skew policy
-
Update the
aptpackage index and install packages needed to use the Kubernetesaptrepository:sudo apt-go update sudo apt-get install -y apt-ship-https ca-certificates curl -
Download the Google Deject public signing key:
sudo curl -fsSLo /usr/share/keyrings/kubernetes-annal-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-fundamental.gpg -
Add together the Kubernetes
aptrepository:echo "deb [signed-by=/usr/share/keyrings/kubernetes-annal-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list -
Update
aptpackage alphabetize, install kubelet, kubeadm and kubectl, and pin their version:sudo apt-get update sudo apt-get install -y kubelet kubeadm kubectl sudo apt-marker hold kubelet kubeadm kubectl
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 repo_gpgcheck=1 gpgkey=https://packages.deject.google.com/yum/medico/yum-key.gpg https://packages.deject.google.com/yum/md/rpm-package-key.gpg exclude=kubelet kubeadm kubectl EOF # Prepare SELinux in permissive way (effectively disabling it) sudo setenforce 0 sudo sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config sudo yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes sudo systemctl enable --at present kubelet Notes:
-
Setting SELinux in permissive mode by running
setenforce 0andsed ...effectively disables it. This is required to allow containers to access the host filesystem, which is needed past pod networks for instance. Yous have to do this until SELinux support is improved in the kubelet. -
You can leave SELinux enabled if you know how to configure it but it may require settings that are not supported by kubeadm.
-
If the
baseurlfails because your Cherry-red Hat-based distribution cannot interpretbasearch, replace\$basearchwith your computer's compages. Typeuname -1000to run into that value. For example, thebaseurlURL forx86_64could be:https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64.
Install CNI plugins (required for almost pod network):
CNI_VERSION = "v0.eight.2" Arch = "amd64" sudo mkdir -p /opt/cni/bin curl -L "https://github.com/containernetworking/plugins/releases/download/ ${ CNI_VERSION } /cni-plugins-linux- ${ Curvation } - ${ CNI_VERSION } .tgz" | sudo tar -C /opt/cni/bin -xz Define the directory to download command files
DOWNLOAD_DIR =/usr/local/bin sudo mkdir -p $DOWNLOAD_DIR Install crictl (required for kubeadm / Kubelet Container Runtime Interface (CRI))
CRICTL_VERSION = "v1.22.0" ARCH = "amd64" curl -L "https://github.com/kubernetes-sigs/cri-tools/releases/download/ ${ CRICTL_VERSION } /crictl- ${ CRICTL_VERSION } -linux- ${ Curvation } .tar.gz" | sudo tar -C $DOWNLOAD_DIR -xz Install kubeadm, kubelet, kubectl and add a kubelet systemd service:
RELEASE = " $(ringlet -sSL https://dl.k8s.io/release/stable.txt) " ARCH = "amd64" cd $DOWNLOAD_DIR sudo curl -50 --remote-name-all https://storage.googleapis.com/kubernetes-release/release/${ RELEASE }/bin/linux/${ Curvation }/{kubeadm,kubelet,kubectl} sudo chmod +x {kubeadm,kubelet,kubectl} RELEASE_VERSION = "v0.4.0" curl -sSL "https://raw.githubusercontent.com/kubernetes/release/ ${ RELEASE_VERSION } /cmd/kubepkg/templates/latest/deb/kubelet/lib/systemd/organization/kubelet.service" | sed "s:/usr/bin: ${ DOWNLOAD_DIR } :g" | sudo tee /etc/systemd/system/kubelet.service sudo mkdir -p /etc/systemd/organization/kubelet.service.d curl -sSL "https://raw.githubusercontent.com/kubernetes/release/ ${ RELEASE_VERSION } /cmd/kubepkg/templates/latest/deb/kubeadm/x-kubeadm.conf" | sed "south:/usr/bin: ${ DOWNLOAD_DIR } :yard" | sudo tee /etc/systemd/arrangement/kubelet.service.d/x-kubeadm.conf Enable and kickoff kubelet:
systemctl enable --now kubelet The kubelet is at present restarting every few seconds, as it waits in a crashloop for kubeadm to tell it what to do.
Configuring a cgroup commuter
Both the container runtime and the kubelet have a property called "cgroup driver", which is of import for the management of cgroups on Linux machines.
Troubleshooting
If you are running into difficulties with kubeadm, please consult our troubleshooting docs.
What's side by side
- Using kubeadm to Create a Cluster
Source: https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/
Posted by: riverashmed1979.blogspot.com

0 Response to "How To Install A Kubernetes Cluster On Centos 7"
Post a Comment