76 lines
2.9 KiB
Markdown
76 lines
2.9 KiB
Markdown
# kubeadm-photon-os
|
|
|
|
### Pre-Requisitos
|
|
|
|
sed -i -e "s/^PermitRootLogin *no$/PermitRootLogin yes/" /etc/ssh/sshd_config && systemctl restart sshd
|
|
|
|
mkdir /etc/docker
|
|
|
|
cat > /etc/docker/daemon.json <<EOF
|
|
{
|
|
"exec-opts": ["native.cgroupdriver=systemd"],
|
|
"log-driver": "json-file",
|
|
"log-opts": {
|
|
"max-size": "100m"
|
|
},
|
|
"storage-driver": "overlay2",
|
|
"storage-opts": [
|
|
"overlay2.override_kernel_check=true"
|
|
]
|
|
}
|
|
EOF
|
|
|
|
systemctl daemon-reload
|
|
systemctl enable docker
|
|
systemctl restart docker
|
|
|
|
tdnf install -y tar wget ebtables ethtool socat conntrack-tools
|
|
CNI_VERSION="v0.8.2"
|
|
mkdir -p /opt/cni/bin
|
|
curl -L "https://github.com/containernetworking/plugins/releases/download/${CNI_VERSION}/cni-plugins-linux-amd64-${CNI_VERSION}.tgz" | tar -C /opt/cni/bin -xz
|
|
DOWNLOAD_DIR=/usr/local/bin
|
|
CRICTL_VERSION="v1.21.3"
|
|
curl -L "https://github.com/kubernetes-sigs/cri-tools/releases/download/${CRICTL_VERSION}/crictl-${CRICTL_VERSION}-linux-amd64.tar.gz" | tar -C $DOWNLOAD_DIR -xz
|
|
RELEASE="$(curl -sSL https://dl.k8s.io/release/stable.txt)"
|
|
cd $DOWNLOAD_DIR
|
|
curl -L --remote-name-all https://storage.googleapis.com/kubernetes-release/release/${RELEASE}/bin/linux/amd64/{kubeadm,kubelet,kubectl}
|
|
chmod +x {kubeadm,kubelet,kubectl}
|
|
RELEASE_VERSION="v0.2.7"
|
|
curl -sSL "https://raw.githubusercontent.com/kubernetes/release/${RELEASE_VERSION}/cmd/kubepkg/templates/latest/deb/kubelet/lib/systemd/system/kubelet.service" | sed "s:/usr/bin:${DOWNLOAD_DIR}:g" | tee /etc/systemd/system/kubelet.service
|
|
mkdir -p /etc/systemd/system/kubelet.service.d
|
|
curl -sSL "https://raw.githubusercontent.com/kubernetes/release/${RELEASE_VERSION}/cmd/kubepkg/templates/latest/deb/kubeadm/10-kubeadm.conf" | sed "s:/usr/bin:${DOWNLOAD_DIR}:g" | tee /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
|
|
systemctl enable --now kubelet
|
|
systemctl daemon-reload
|
|
|
|
cat <<EOF > /etc/sysctl.d/k8s.conf
|
|
net.ipv4.ip_forward = 1
|
|
net.bridge.bridge-nf-call-ip6tables = 1
|
|
net.bridge.bridge-nf-call-iptables = 1
|
|
EOF
|
|
sysctl --system
|
|
|
|
systemctl disable iptables
|
|
systemctl stop iptables
|
|
|
|
### Instalación de ETCD Externo
|
|
|
|
wget https://pkg.cfssl.org/R1.2/cfssl_linux-amd64
|
|
wget https://pkg.cfssl.org/R1.2/cfssljson_linux-amd64
|
|
chmod +x cfssl*
|
|
mv cfssl_linux-amd64 /usr/local/bin/cfssl
|
|
mv cfssljson_linux-amd64 /usr/local/bin/cfssljson
|
|
|
|
|
|
cfssl gencert -initca ca-csr.json | cfssljson -bare ca
|
|
|
|
cfssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=ca-config.json -hostname=172.16.100.100,172.16.100.101,172.16.100.102,172.16.100.103,127.0.0.1,kubernetes.default -profile=kubernetes kubernetes-csr.json | cfssljson -bare kubernetes
|
|
|
|
scp ca.pem kubernetes.pem kubernetes-key.pem root@<"PeerIPx">:~
|
|
|
|
cp ca.pem kubernetes.pem kubernetes-key.pem /etc/etcd
|
|
|
|
wget https://github.com/coreos/etcd/releases/download/v3.5.0/etcd-v3.5.0-linux-amd64.tar.gz
|
|
tar -zxvf etcd-v3.5.0-linux-amd64.tar.gz
|
|
mv etcd-v3.5.0-linux-amd64/etcd* /usr/local/bin/
|
|
|
|
mv etcd.service /etc/systemd/system/etcd.service |