Kubernetes Controller: Difference between revisions
(update flannel manifest for v1.16+) |
DrEdWilliams (talk | contribs) (added description on how to direct pod traffic onto secondary interface) |
||
| Line 49: | Line 49: | ||
== Install flannel pod network == | == Install flannel pod network == | ||
The Flannel pod networking can be installed directly from the repository using this command: | |||
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml | kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml | ||
By default, flannel uses the primary network interface (eth0 on 10.0.0.0/24); but if you want to push the traffic onto the secondary interfaces (such as for the development cluster), download the YAML manifest and add one parameter to the argument list on/about line 190. The result should look like this: | |||
... | |||
args: | |||
- --ip-masq | |||
- --kube-subnet-mgr | |||
- --iface=eth1 | |||
resources: | |||
... | |||
substitute the secondary interface name for 'eth1' if it is different. Then apply the manifest: | |||
kubectl apply -f | kubectl apply -f kube-flannel.yaml | ||
== Enable pods to run on master node if desired == | == Enable pods to run on master node if desired == | ||
kubectl taint nodes --all node-role.kubernetes.io/master- | kubectl taint nodes --all node-role.kubernetes.io/master- | ||
Revision as of 11:55, 25 December 2019
The kubernetes controller install is based on the prerequisites in the Kubernetes Cluster Installation page.
Install the kubernetes repo
CentOS 7
cat <<EOF > /etc/yum.repos.d/kubernetes.repo [kubernetes] name=Kubernetes baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64 enabled=1 gpgcheck=1 repo_gpgcheck=1 gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg exclude=kube* EOF
... or just copy it from an already installed kubernetes node ...
Install the pieces of the kubeadm installation on all nodes
yum install -y kubelet kubectl kubeadm --disableexcludes=kubernetes
Debian 10
apt-get update && apt-get install -y apt-transport-https curl curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - cat <<EOF >/etc/apt/sources.list.d/kubernetes.list deb https://apt.kubernetes.io/ kubernetes-xenial main EOF apt-get update apt-get install -y kubelet kubeadm kubectl apt-mark hold kubelet kubeadm kubectl
Install the master
Make sure that /etc/sysconfig/kubelet (or /etc/default/kubelet for Debian) has the following line:
KUBELET_EXTRA_ARGS=--authentication-token-webhook --fail-swap-on=false --feature-gates=DevicePlugins=true --kubelet-cgroups=/systemd/system.slice systemctl start kubelet systemctl enable kubelet
Initialize master with parameter to support flannel network (as root)
kubeadm init --pod-network-cidr=10.244.0.0/16 --token-ttl 0 --ignore-preflight-errors Swap --node-name `hostname -s`
Initialize authentication for kubectl
mkdir -p $HOME/.kube sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config sudo chown $(id -u):$(id -g) $HOME/.kube/config
Install flannel pod network
The Flannel pod networking can be installed directly from the repository using this command:
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
By default, flannel uses the primary network interface (eth0 on 10.0.0.0/24); but if you want to push the traffic onto the secondary interfaces (such as for the development cluster), download the YAML manifest and add one parameter to the argument list on/about line 190. The result should look like this:
... args: - --ip-masq - --kube-subnet-mgr - --iface=eth1 resources: ...
substitute the secondary interface name for 'eth1' if it is different. Then apply the manifest:
kubectl apply -f kube-flannel.yaml
Enable pods to run on master node if desired
kubectl taint nodes --all node-role.kubernetes.io/master-