1

当我使用亚马逊云服务建好的centos7服务时,发现docker版本太旧了,而目前kubernetes不支持docker-ce,
这里主要讲一下在安装docker-1.13.1及启动需要修改的一些配置文件.  

centos7安装docker-1.13.1

删除旧版本的docker

sudo yum remove -y docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-selinux \
                  docker-engine-selinux \
                  docker-engine

安装docker

sudo yum install -y yum-utils device-mapper-persistent-data lvm2

sudo yum-config-manager --add-repo  https://download.docker.com/linux/centos/docker-ce.repo

sudo yum install docker -y

启动docker

修改/etc/sysconfig/docker文件

# 将--selinux-enabled设置为false,不然可能会由于selinux服务不能用导致docker启动失败  

OPTIONS='--selinux-enabled=false --log-driver=json-file --signature-verification=false'

修改systemd启动参数

# 这个启动参数是centos7自带的docker1.11.1版本需要的,会导致docker1.13.1启动失败
mv /etc/systemd/system/docker.service.d/execstart.conf /etc/systemd/system/docker.service.d/execstart.conf.cp
systemctl daemon-reload
systemctl enable docker && systemctl start docker

centos7安装kubelet/kubectl/kubeadm-1.9.5

安装kubeadm, kubelet, kubectl

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
EOF
yum install -y kubelet-1.9.5 kubeadm-1.9.5 kubectl-1.9.5

修改k8s.conf

官网文档上写一些用户在RHEL/Centos7系统上安装时,由于iptables被绕过导致路由错误,需要在
sysctl的config文件中将net.bridge.bridge-nf-call-iptables设置为1.

cat <<EOF >  /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
sysctl --system

启动kubelet

systemctl enable kubelet && systemctl start kubelet

VincentFF
84 声望0 粉丝