kubefed init表示“等待联邦控制平面升起”,但它永远不会升起

时间:2019-02-17 09:03:42

标签: kubernetes kops

我已经使用kops命令创建了集群。对于每个群集,我必须创建一个托管区域并将名称空间添加到DNS提供程序。要创建托管区域,我使用以下命令在aws(example.com)的托管区域中创建了一个子域:

ID=$(uuidgen) && aws route53 create-hosted-zone --name subdomain1.example.com --caller-reference $ID | jq .DelegationSet.NameServers

我通过执行上述命令获得的名称服务器包含在新创建的文件subdomain1.json中,其内容如下。

{
  "Comment": "Create a subdomain NS record in the parent domain",
  "Changes": [
    {
      "Action": "CREATE",
      "ResourceRecordSet": {
        "Name": "subdomain1.example.com",
        "Type": "NS",
        "TTL": 300,
        "ResourceRecords": [
          {
            "Value": "ns-1.awsdns-1.co.uk"
          },
          {
            "Value": "ns-2.awsdns-2.org"
          },
          {
            "Value": "ns-3.awsdns-3.com"
          },
          {
            "Value": "ns-4.awsdns-4.net"
          }
        ]
      }
    }
  ]
}

要获取父区域ID,我使用了以下命令:

aws route53 list-hosted-zones | jq '.HostedZones[] | select(.Name=="example.com.") | .Id'

要将子域NS记录应用于父托管区域-

aws route53 change-resource-record-sets --hosted-zone-id <parent-zone-id> --change-batch file://subdomain1.json

然后我使用kops命令创建了集群-

kops create cluster --name=subdomain1.example.com --master-count=1 --master-zones ap-southeast-1a --node-count=1 --zones=ap-southeast-1a --authorization=rbac --state=s3://example.com --kubernetes-version=1.11.0 --yes

我能够创建一个集群,对其进行验证并获取其节点。通过使用相同的过程,我又创建了一个群集(subdomain2.example.com)。

我已经使用这些命令为两个集群设置了别名-

kubectl config set-context subdomain1 --cluster=subdomain1.example.com --user=subdomain1.example.com

kubectl config set-context subdomain2 --cluster=subdomain2.example.com --user=subdomain2.example.com

要在这两个集群之间建立联盟,我使用了以下命令-     kubectl配置使用上下文subdomain1

kubectl create clusterrolebinding admin-to-cluster-admin-binding --clusterrole=cluster-admin --user=admin

kubefed init interstellar --host-cluster-context=subdomain1 --dns-provider=aws-route53 --dns-zone-name=example.com

-The output of kubefed init command should be

但是对我来说,它显示为“正在等待联邦控制平面升起……”,但是没有升高。可能是什么错误?

我已经按照以下教程创建了两个集群。

https://gist.github.com/arun-gupta/02f534c7720c8e9c9a875681b430441a

1 个答案:

答案 0 :(得分:3)

用于联盟api服务器和控制器管理器二进制文件的默认图像存在问题。默认情况下,kubefed init命令考虑以下图像:  “ gcr.io/k8s-jkns-e2e-gce-federation/fcp-amd64:v0.0.0-master_$Format:%h$”。

但是此图像较旧且不可用,联邦控制平面尝试拉出图像但失败。这是我得到的错误。

要进行纠正,请构建自己的fcp映像并将其推送到某个存储库,然后在kubefed init命令中使用该映像。下面是要执行的指令(从此路径“ $ GOPATH / src / k8s.io / kubernetes / federation”运行所有这些命令)-

创建fcp映像并将其推送到存储库-

docker load -i  _output/release-images/amd64/fcp-amd64.tar

docker tag gcr.io/google_containers/fcp-amd64:v1.9.0-alpha.2.60_430416309f9e58-dirty REGISTRY/REPO/IMAGENAME[:TAG] 

docker push REGISTRY/REPO/IMAGENAME[:TAG]

现在使用以下命令创建联合控制平面-

_output/dockerized/bin/linux/amd64/kubefed init myfed --host-cluster-context=HOST_CLUSTER_CONTEXT --image=REGISTRY/REPO/IMAGENAME[:TAG] --dns-provider="PROVIDER" --dns-zone-name="YOUR_ZONE" --dns-provider-config=/path/to/provider.conf