安装Kubernetes

Gao
# 在 Ubuntu 上安装 kubeadm ## 安装之前 基本配置要求: - One or more machines running one of: - Ubuntu 16.04+ - Debian 9 - CentOS 7 - RHEL 7 - Fedora 25/26 (best-effort) - HypriotOS v1.0.1+ - Container Linux (tested with 1576.4.0) - 2 GB or more of RAM per machine (any less will leave little room for your apps) - 2 CPUs or more - Full network connectivity between all machines in the cluster (public or private network is fine) - Unique hostname, MAC address, and product_uuid for every node. See here for more details. - Certain ports are open on your machines. See here for more details. - Swap disabled. You MUST disable swap in order for the kubelet to work properly. ## 安装 Docker ``` apt-get update apt-get install -y apt-transport-https ca-certificates curl software-properties-common curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - add-apt-repository "deb https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") $(lsb_release -cs) stable" apt-get update && apt-get install -y docker-ce=$(apt-cache madison docker-ce | grep 17.03 | head -1 | awk '{print $3}') ``` ## 安装 kubeadm, kubelet and kubectl ``` 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 http://apt.kubernetes.io/ kubernetes-xenial main EOF apt-get update apt-get install -y kubelet kubeadm kubectl apt-mark hold kubelet kubeadm kubectl ``` ## 运行 ``` kubeadm init ```