云原生技术---kubeadm使用外置etcd集群

创建etcd 集群

参考文章:云原生技术—高可用etcd数据库集群搭建

准备kubeadm.yml

apiVersion: kubeadm.k8s.io/v1beta2
bootstrapTokens:
  - groups:
      - system:bootstrappers:kubeadm:default-node-token
    token: abcdef.0123456789abcdef
    ttl: 24h0m0s
    usages:
      - signing
      - authentication
kind: InitConfiguration
localAPIEndpoint:
  # 本机ip
  advertiseAddress: 172.18.30.199
  bindPort: 6443
nodeRegistration:
  criSocket: /var/run/dockershim.sock
  # 本机hostname
  name: k8s-master
  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:
  external:
    # 修改etcd服务器地址
    endpoints:
      - https://172.18.30.195:2379
      - https://172.18.30.196:2379
      - https://172.18.30.197:2379
    #搭建etcd集群时生成的ca证书
    caFile: /etc/etcd/pki/ca.pem
    #搭建etcd集群时生成的客户端证书
    certFile: /etc/etcd/pki/client.pem
    #搭建etcd集群时生成的客户端密钥
    keyFile: /etc/etcd/pki/client-key.pem
imageRepository: registry.aliyuncs.com/google_containers
kind: ClusterConfiguration
kubernetesVersion: v1.18.0
# keepalived vip地址
#controlPlaneEndpoint: 172.18.30.199
networking:
  dnsDomain: svc.cluster.local
  podSubnet: 10.100.0.0/16
  serviceSubnet: 10.200.0.0/16
scheduler: {}
---
apiVersion: kubeproxy.config.k8s.io/v1alpha1
kind: KubeProxyConfiguration
# iptables / ipvs ,ipvs 在1.18版本,需要linux 内核 4.x
mode: iptables

执行adm安装

kubeadm init --config=kubeadm.yml

你可能感兴趣的:(云原生,云计算,云原生,etcd,kubernetes)