标签:mos Kubernete root fail call rgs lin error --
dokube.sh
#!/bin/sh
yum list wget &&
yum -y install wget &&
cd /etc/yum.repos.d/ &&
wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo &&
cat >> /etc/yum.repos.d/kubernetes.repo <<EOF
#!/bin/sh
#
[kubernetes]
name=kubernetes
baseurl=https://mirrors.huaweicloud.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
gpgkey=https://mirrors.huaweicloud.com/kubernetes/yum/doc/rpm-package-key.gpg
gpgcheck=1
enables=1
EOF
yum clean all &&
yum repolist &&
yum list docker-ce kubectl kubelet kubeadm &&
yum -y install docker-ce kubeadm kubectl kubelet
echo > /etc/hostname <<EOF
mostre
EOF
hostname mostre &&
systemctl enable docker kubelet &&
mkdir -p /etc/docker &&
cat > /etc/docker/daemon.json <<EOF
{
"registry-mirrors": ["https://qijo5n63.mirror.aliyuncs.com"],
"exec-opts": ["native.cgroupdriver=systemd"]
}
EOF
systemctl daemon-reload &&
systemctl start docker &&
echo "1" > /proc/sys/net/bridge/bridge-nf-call-iptables
echo "1" > /proc/sys/net/bridge/bridge-nf-call-ip6tables
systemctl disable firewalld &&
systemctl stop firewalld &&
swapoff -a &&
cat > /etc/sysconfig/kubelet <<EOF
KUBELET_EXTRA_ARGS="--fail-swap-on=false"
EOF
systemctl enable docker kubelet &&
/bin/sh -x /root/kubeadminit.sh
kubeadminit.sh
#!/bin/sh
KUBE_VERSION=`kubelet --version | awk -F ' ' '{print $2}'`
list=$(kubeadm config images list --kubernetes-version=${KUBE_VERSION})
for line in ${list}
do
echo ${line}
# docker pull $line
image=`echo ${line} | awk '{ sub(/k8s.gcr.io/,"gcr.azk8s.cn/google_containers"); print $0 }'`
echo ${image}
docker pull ${image}
docker tag ${image} ${line}
docker rmi ${image}
done &&
kubeadm init --kubernetes-version=v1.14.2 --service-cidr=10.96.0.0/12 --ignore-preflight-errors=Swap &&
# --pod-network-cidr=10.244.0.0/16 绒布网络使用
mkdir -p $HOME/.kube &&
cp -i /etc/kubernetes/admin.conf $HOME/.kube/config &&
kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"
# docker pull quay.azk8s.cn/coreos/flannel:v0.11.0-amd64 &&
# docker tag quay.azk8s.cn/coreos/flannel:v0.11.0-amd64 quay.io/coreos/flannel:v0.11.0-amd64 &&
# cd &&
# kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/v0.11.0/Documentation/kube-flannel.yml &&
#!/bin/sh
yum list wget &&
yum -y install wget &&
cd /etc/yum.repos.d/ &&
wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo &&
cat >> /etc/yum.repos.d/kubernetes.repo <<EOF
#!/bin/sh
#
[kubernetes]
name=kubernetes
baseurl=https://mirrors.huaweicloud.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
gpgkey=https://mirrors.huaweicloud.com/kubernetes/yum/doc/rpm-package-key.gpg
gpgcheck=1
enables=1
EOF
yum clean all &&
yum repolist &&
yum list docker-ce kubectl kubelet kubeadm &&
yum -y install docker-ce kubeadm kubectl kubelet
echo > /etc/hostname <<EOF
node1
EOF
hostname node1 &&
systemctl enable docker kubelet &&
mkdir -p /etc/docker &&
cat > /etc/docker/daemon.json <<EOF
{
"registry-mirrors": ["https://qijo5n63.mirror.aliyuncs.com"],
"exec-opts": ["native.cgroupdriver=systemd"]
}
EOF
systemctl daemon-reload &&
systemctl start docker &&
echo "1" > /proc/sys/net/bridge/bridge-nf-call-iptables
echo "1" > /proc/sys/net/bridge/bridge-nf-call-ip6tables
systemctl disable firewalld &&
systemctl stop firewalld &&
swapoff -a &&
cat > /etc/sysconfig/kubelet <<EOF
KUBELET_EXTRA_ARGS="--fail-swap-on=false"
EOF
systemctl enable docker kubelet &&
/bin/sh -x /root/kubemirror.sh
kubemirror.sh
#!/bin/sh
KUBE_VERSION=`kubelet --version | awk -F ' ' '{print $2}'`
list=$(kubeadm config images list --kubernetes-version=${KUBE_VERSION})
for line in ${list}
do
echo ${line}
# docker pull $line
image=`echo ${line} | awk '{ sub(/k8s.gcr.io/,"gcr.azk8s.cn/google_containers"); print $0 }'`
echo ${image}
docker pull ${image}
docker tag ${image} ${line}
docker rmi ${image}
done
dokube.sh
#!/bin/sh
yum list wget &&
yum -y install wget &&
cd /etc/yum.repos.d/ &&
wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo &&
cat >> /etc/yum.repos.d/kubernetes.repo <<EOF
#!/bin/sh
#
[kubernetes]
name=kubernetes
baseurl=https://mirrors.huaweicloud.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
gpgkey=https://mirrors.huaweicloud.com/kubernetes/yum/doc/rpm-package-key.gpg
gpgcheck=1
enables=1
EOF
yum clean all &&
yum repolist &&
yum list docker-ce kubectl kubelet kubeadm &&
yum -y install docker-ce kubeadm kubectl kubelet
echo > /etc/hostname <<EOF
node2
EOF
hostname node2 &&
systemctl enable docker kubelet &&
mkdir -p /etc/docker &&
cat > /etc/docker/daemon.json <<EOF
{
"registry-mirrors": ["https://qijo5n63.mirror.aliyuncs.com"],
"exec-opts": ["native.cgroupdriver=systemd"]
}
EOF
systemctl daemon-reload &&
systemctl start docker &&
echo "1" > /proc/sys/net/bridge/bridge-nf-call-iptables
echo "1" > /proc/sys/net/bridge/bridge-nf-call-ip6tables
systemctl disable firewalld &&
systemctl stop firewalld &&
swapoff -a &&
cat > /etc/sysconfig/kubelet <<EOF
KUBELET_EXTRA_ARGS="--fail-swap-on=false"
EOF
systemctl enable docker kubelet &&
/bin/sh -x /root/kubemirror.sh
kubemirror.sh
#!/bin/sh
KUBE_VERSION=`kubelet --version | awk -F ' ' '{print $2}'`
list=$(kubeadm config images list --kubernetes-version=${KUBE_VERSION})
for line in ${list}
do
echo ${line}
# docker pull $line
image=`echo ${line} | awk '{ sub(/k8s.gcr.io/,"gcr.azk8s.cn/google_containers"); print $0 }'`
echo ${image}
docker pull ${image}
docker tag ${image} ${line}
docker rmi ${image}
done
IP=ip addr show enp0s3 | grep inet | grep -v inet6 | awk ‘{print $2}‘ | awk -F ‘/‘ ‘{print $1}‘
标签:mos Kubernete root fail call rgs lin error --
原文地址:https://www.cnblogs.com/hao-ran/p/11614191.html