kubernetes-master安装

给你一囗甜甜゛ 提交于 2020-07-25 07:34:17

导出配置文件
kubeadm config print init-defaults > kubernetes-config.yaml
修改配置文件
vim kubernetes-config.yaml
#配置信息
apiVersion: kubeadm.k8s.io/v1beta2
bootstrapTokens:





  • groups:
    • system:bootstrappers:kubeadm:default-node-token
      token: abcdef.0123456789abcdef
      ttl: 24h0m0s
      usages:


    • signing
    • authentication
      kind: InitConfiguration
      localAPIEndpoint:
      advertiseAddress: 192.168.100.10
      bindPort: 6443
      nodeRegistration:
      criSocket: /var/run/dockershim.sock
      name: master01
      taints:







    • effect: NoSchedule
      key: node-role.kubernetes.io/master

      apiServer:
      timeoutForControlPlane: 4m0s
      apiVersion: kubeadm.k8s.io/v1beta2
      certificatesDir: /etc/kubernetes/pki
      clusterName: kubernetes
      controllerManager: {}
      dns:
      type: CoreDNS
      etcd:
      local:
      dataDir: /var/lib/etcd
      imageRepository: registry.cn-hangzhou.aliyuncs.com/google_containers
      kind: ClusterConfiguration
      kubernetesVersion: v1.15.1
      networking:
      dnsDomain: cluster.local
      podSubnet: 10.244.0.0/16
      serviceSubnet: 10.96.0.0/12
      scheduler: {}

















      apiVersion: kubeproxy.config.k8s.io/v1alpha1
      kind: KubeProxyConfiguration
      featureGates:
      SupportIPVSProxyMode: true
      mode: ipvs
      安装master
      kubeadm init --config=kubernetes-config.yaml --experimental-upload-certs | tee kubeadm-init.log
      *此处可以将包提前下载好导入到docker中
      创建相应配置目录
      mkdir -p $HOME/.kube
      cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
      chown $(id -u):$(id -g) $HOME/.kube/config
      安装flannel管理网络
      wget https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
      sed -i s#'quay.io/coreos'#'registry.cn-hangzhou.aliyuncs.com/kube-iamges'#g kube-flannel.yml
      在node节点上执行
      kubeadm join 192.168.100.10:6443 --token abcdef.0123456789abcdef \
      --discovery-token-ca-cert-hash sha256:d343c8af1afc768ee1f64d2c5cc9225ecf7140d53a5fd7072ab920a7138446fe
      kubectl apply -f kube-flannel.yml

















易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!