2019-05-05

使用阿里云ECS搭建k8s1.11



基本环境

|左对齐|剧中|右对齐|

|:-|:-:|-:|

|A1|B1|C1|

|A2|B2|C2|

一个master(node1)和一个node(node2)

node1.com安装的组件:

kube-apiserver

kube-controller-manager

kube-scheduler

kube-flannel

kube-proxy

coredns

etcd

node2.com安装的组件:

kube-flannel

kube-proxy

coredns

cat < /etc/yum.repos.d/kubernetes.repo

[kubernetes]

name=Kubernetes

baseurl=http://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64

enabled=1

gpgcheck=0

repo_gpgcheck=0

gpgkey=http://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg

      http://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg

EOF

yum update

yum upgrade

yum clean all

yum makecache

##########################################

yum install -y docker

pvcreate /dev/vdb

vgcreate docker-vg /dev/vdb

echo VG=docker-vg > /etc/sysconfig/docker-storage-setup

docker-storage-setup

lvextend -l 100%VG  /dev/docker-vg/docker-pool

systemctl start docker

systemctl enable docker

yum list --showduplicates | grep kubelet

yum install -y kubelet-1.13.1

yum install -y kubectl-1.11.1

yum install -y kubeadm-1.13.1

yum install -y ipvsadm

yum list installed | grep "kubernetes\|docker"

systemctl stop firewalld && systemctl disable firewalld

swapoff -a

setenforce 0

modprobe br_netfilter

    echo "

        net.ipv4.ip_forward = 1

        net.bridge.bridge-nf-call-ip6tables = 1

        net.bridge.bridge-nf-call-iptables = 1

    " > /etc/sysctl.d/k8s.conf

    sysctl -p /etc/sysctl.d/k8s.conf

    # 加载ipvs相关内核模块

    # 如果重新开机,需要重新加载

    modprobe ip_vs

    modprobe ip_vs_rr

    modprobe ip_vs_wrr

    modprobe ip_vs_sh

    modprobe nf_conntrack_ipv4

    lsmod | grep ip_vs

cat <> /etc/hosts

172.31.2.130 node1.zjl.com

172.31.2.131 node2.zjl.com

EOF

ssh-keygen

ssh-copy-id [email protected]

systemctl enable docker kubelet

docker pull mirrorgooglecontainers/kube-apiserver-amd64:v1.13.1

docker pull mirrorgooglecontainers/pause-amd64:3.1

docker pull mirrorgooglecontainers/kube-controller-manager-amd64:v1.13.1

docker pull mirrorgooglecontainers/kube-scheduler-amd64:v1.13.1

docker pull mirrorgooglecontainers/kube-proxy-amd64:v1.13.1

docker pull mirrorgooglecontainers/etcd-amd64:3.2.18

docker pull coredns/coredns:1.1.3

docker tag mirrorgooglecontainers/kube-apiserver-amd64:v1.13.1 k8s.gcr.io/kube-apiserver:v1.13.1

docker tag mirrorgooglecontainers/pause-amd64:3.1 k8s.gcr.io/pause:3.1

docker tag mirrorgooglecontainers/kube-controller-manager-amd64:v1.13.1 k8s.gcr.io/kube-controller-manager:v1.13.1

docker tag mirrorgooglecontainers/kube-scheduler-amd64:v1.13.1 k8s.gcr.io/kube-scheduler:v1.13.1

docker tag mirrorgooglecontainers/kube-proxy-amd64:v1.13.1 k8s.gcr.io/kube-proxy:v1.13.1

docker tag mirrorgooglecontainers/etcd-amd64:3.2.18 k8s.gcr.io/etcd-amd64:3.2.18

docker tag coredns/coredns:1.1.3 k8s.gcr.io/coredns:1.1.3

kubeadm init --kubernetes-version=v1.11.1 --pod-network-cidr=10.244.0.0/16

mkdir -p $HOME/.kube

sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config

sudo chown $(id -u):$(id -g) $HOME/.kube/config




route ip+net: no such network interface

你可能感兴趣的:(2019-05-05)