kubernetes-retired / cluster-api-provider-nested

Cluster API Provider for Nested Clusters
Apache License 2.0
301 stars 67 forks source link

[Quick Start] Failed connect to cluster #71

Closed gyliu513 closed 3 years ago

gyliu513 commented 3 years ago

I was following https://github.com/kubernetes-sigs/cluster-api-provider-nested/blob/main/docs/README.md to run a quick. test for CAPN, but in last step, connect to the cluster failed, can anyone help share some insight for what is wrong?

@charleszheng44 ^^

Guangyas-MacBook-Pro:kubernetes-sigs guangyaliu$ kubectl --kubeconfig kubeconfig get all -A
Unable to connect to the server: net/http: TLS handshake timeout

I can see the nested control plane is running:

Guangyas-MacBook-Pro:kubernetes-sigs guangyaliu$ kubectl get pod
NAME                                  READY   STATUS    RESTARTS   AGE
cluster-sample-apiserver-0            1/1     Running   0          17m
cluster-sample-controller-manager-0   1/1     Running   2          17m
cluster-sample-etcd-0                 1/1     Running   0          17m

But the cluster status is Provisioning

Guangyas-MacBook-Pro:kubernetes-sigs guangyaliu$ kubectl get clusters
NAME             PHASE
cluster-sample   Provisioning
Guangyas-MacBook-Pro:kubernetes-sigs guangyaliu$ kubectl get clusters -oyaml
apiVersion: v1
items:
- apiVersion: cluster.x-k8s.io/v1alpha4
  kind: Cluster
  metadata:
    annotations:
      kubectl.kubernetes.io/last-applied-configuration: |
        {"apiVersion":"cluster.x-k8s.io/v1alpha4","kind":"Cluster","metadata":{"annotations":{},"name":"cluster-sample","namespace":"default"},"spec":{"controlPlaneEndpoint":{"host":"cluster-sample-apiserver","port":6443},"controlPlaneRef":{"apiVersion":"controlplane.cluster.x-k8s.io/v1alpha4","kind":"NestedControlPlane","name":"nestedcontrolplane-sample","namespace":"default"},"infrastructureRef":{"apiVersion":"infrastructure.cluster.x-k8s.io/v1alpha4","kind":"NestedCluster","name":"nestedcluster-sample","namespace":"default"}}}
    creationTimestamp: "2021-05-22T14:41:16Z"
    finalizers:
    - cluster.cluster.x-k8s.io
    generation: 1
    managedFields:
    - apiVersion: cluster.x-k8s.io/v1alpha4
      fieldsType: FieldsV1
      fieldsV1:
        f:metadata:
          f:annotations:
            .: {}
            f:kubectl.kubernetes.io/last-applied-configuration: {}
        f:spec:
          .: {}
          f:controlPlaneEndpoint:
            .: {}
            f:host: {}
            f:port: {}
          f:controlPlaneRef:
            .: {}
            f:apiVersion: {}
            f:kind: {}
            f:name: {}
            f:namespace: {}
          f:infrastructureRef:
            .: {}
            f:apiVersion: {}
            f:kind: {}
            f:name: {}
            f:namespace: {}
      manager: kubectl-client-side-apply
      operation: Update
      time: "2021-05-22T14:41:16Z"
    - apiVersion: cluster.x-k8s.io/v1alpha4
      fieldsType: FieldsV1
      fieldsV1:
        f:metadata:
          f:finalizers:
            .: {}
            v:"cluster.cluster.x-k8s.io": {}
        f:status:
          .: {}
          f:conditions: {}
          f:controlPlaneReady: {}
          f:observedGeneration: {}
          f:phase: {}
      manager: manager
      operation: Update
      time: "2021-05-22T14:44:32Z"
    name: cluster-sample
    namespace: default
    resourceVersion: "4670"
    uid: c2884e62-87f0-4709-85c5-c6a97e85a631
  spec:
    controlPlaneEndpoint:
      host: cluster-sample-apiserver
      port: 6443
    controlPlaneRef:
      apiVersion: controlplane.cluster.x-k8s.io/v1alpha4
      kind: NestedControlPlane
      name: nestedcontrolplane-sample
      namespace: default
    infrastructureRef:
      apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4
      kind: NestedCluster
      name: nestedcluster-sample
      namespace: default
  status:
    conditions:
    - lastTransitionTime: "2021-05-22T14:41:45Z"
      reason: WaitingForInfrastructure
      severity: Info
      status: "False"
      type: Ready
    - lastTransitionTime: "2021-05-22T14:41:45Z"
      status: "True"
      type: ControlPlaneInitialized
    - lastTransitionTime: "2021-05-22T14:41:45Z"
      status: "True"
      type: ControlPlaneReady
    - lastTransitionTime: "2021-05-22T14:41:17Z"
      reason: WaitingForInfrastructure
      severity: Info
      status: "False"
      type: InfrastructureReady
    controlPlaneReady: true
    observedGeneration: 1
    phase: Provisioning
kind: List
metadata:
  resourceVersion: ""
  selfLink: ""
charleszheng44 commented 3 years ago

@gyliu513 thanks for filing the bug. I made a mistake in the quick start guide 😅 . For the second from the last step, would you do the following instead?

echo '127.0.0.1 cluster-sample-apiserver' >> ~/.hosts
export HOSTALIASES=~/.hosts

Please let me know if it still does not work

gyliu513 commented 3 years ago

Thanks @charleszheng44 , a new issue found at https://github.com/kubernetes-sigs/cluster-api-provider-nested/issues/74