docker组配置

{
  "insecure-registries":["0.0.0.0/0"],
  "exec-opts": ["native.cgroupdriver=systemd"],
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "100m"
  }
}

1,安装系统工具

apt-get update && apt-get install -y apt-transport-https

 2,安装GPG证书

curl https://mirrors.aliyun.com/kubernetes/apt/doc/apt-key.gpg | apt-key add -

3,写入软件源

cat << EOF >/etc/apt/sources.list.d/kubernetes.list
	> deb https://mirrors.aliyun.com/kubernetes/apt/ kubernetes-xenial main
	> EOF

安装 kubeadm,kubelet,kubectl

4,安装 kubeadm

 apt-get update  
 apt-get install -y kubelet kubeadm kubectl

kubeadm:初始化 Kubernetes 集群
kubectl:Kubernetes 的命令行工具,部署和管理应用,查看各种资源,创建,删除和更新组件
kubelet:启动 Pod 和容器

5,设置启动项

systemctl enable kubelet && systemctl start kubelet

6,配置kubeadm配置文件,导出配置文件

kubeadm config print init-defaults --kubeconfig ClusterConfiguration > kubeadm.yml

最小化配置文件:

apiVersion: kubeadm.k8s.io/v1beta1
kind: ClusterConfiguration
kubernetesVersion: v1.14.3
controlPlaneEndpoint: "192.168.7.219:6443" #修改为本地网卡ip
networking:
  podSubnet: 10.244.0.0/16
imageRepository: registry.cn-hangzhou.aliyuncs.com/google_containers

7,查看所需镜像,拉取所需镜像

kubeadm config images list --config kubeadm.yml
kubeadm config images pull --config kubeadm.yml

8,安装master主节点

kubeadm init --config=kubeadm.yml --experimental-upload-certs | tee kubeadm-init.log

9,配置kubectl

mkdir -p $HOME/.kube
#查询kubectl状态
kubectl get no 
#添加cni网络
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/62e44c867a2846fefb68bd5f178daf4da3095ccb/Documentation/kube-flannel.yml

 

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐