kubeadm 初始化阶段 upload-config 失败

kubeadm init phase upload-config failing

我是 kubernetes 的新手,想在成功完成 minikube 和单主 kubernetes 集群示例后设置 kubernetes HA 设置。为此,我正在使用 AWS EC2 实例和 AWS 应用程序负载均衡器。我不想使用 KOPS 或任何其他工具进行安装。我想亲身体验一下 kubeadm。 我按照以下步骤

  1. 创建了自签名证书 ca.crt 和 ca.key 用于 库伯内特
  2. 在我的 ubuntu 上安装此证书作为根 CA 实例
  3. 已将此 ca.crt 和 ca.key 复制到 /etc/kubernetes/pki
  4. 为 aws loadbalancer 创建新证书并签名 它与上面 ca.crt。使用此证书创建 Aws 应用程序 负载平衡器
  5. 我还在AWS Route53中创建了Record Set用于域名映射。我也确定了这个域名 映射正在工作。 (即 master.k8sonaws.com 正确解析为 aws 负载均衡器)
  6. 现在我正在使用 kubeadm init

    kubeadm init --pod-network-cidr=192.168.0.0/20
    --service-cidr=192.168.16.0/20 --node-name=10.0.0.13  --control-plane-endpoint "master.k8sonaws.com:443"  --upload-certs --v=8 --apiserver-bind-port=443 --apiserver-cert-extra-sans=master.k8sonaws.com,i-0836dd4dc6609a924
    
  7. 此命令在 up-to upload-config 阶段之后。健康检查端点返回成功,但 之后它在 upload-config 阶段失败

    configmaps 被禁止:用户 "system:anonymous" 无法在命名空间的 API 组“”中创建资源 "configmaps" "kube-system"

这里我无法理解为什么 kubeadm 传递匿名用户进行 api 调用。我该如何解决这个问题

用于创建ConfigMap 的kubeconfig 文件中的证书没有正确的组。我会说不要自己为 kubernetes 生成 ca 和 cert。只需使用 kubeadm init,kubeadm 将处理 ca 和证书的生成。在您的 kubernetes 集群启动后 运行 您可以使用相同的 ca 自己生成证书并在 aws 负载均衡器中使用它。

I found solution to this problem after trying lot of different things for 2 days. Problem is aws load balancer does not pass client certificate to backend server when using https listener. And problem is Aws has not documented this fact or I did not get those document if they are there.

解决这个问题的方法是使用使用相同端口 443 的平面 http 侦听器。因此 SSL 终止由后备服务器执行。在我的例子中,这不是安全威胁,因为我的负载平衡器和后端服务器都是内部的,没有暴露给 public ip。