kubernetes-retired / kubefed

Kubernetes Cluster Federation
Apache License 2.0
2.5k stars 531 forks source link

enabling ClusterRoleBinding returns error #619

Closed khaledjendi closed 5 years ago

khaledjendi commented 5 years ago

In the user guide for a tutorial of how to deploy the federation v2 control plane, everything went fine until applying the example/sample1. In other worlds, I could join cluster1 and cluster2 and when I describe the federated clusters I can see healthz is ok (I posted the result of federated clusters description)

when I tried to applying the example (kubectl apply -R -f example/sample1), I encountered with error no matches for kind "FederatedClusterRoleBinding" in version "types.federation.k8s.io/v1alpha1" so I tried to enable ClusterRoleBinding using kubefed2 v0.05 then I got error in creating this resource

ubuntu@khaled-jumphost1:~/federation-v2$ kubefed2 enable ClusterRoleBinding
customresourcedefinition.apiextensions.k8s.io/federatedclusterrolebindings.primitives.federation.k8s.io created
customresourcedefinition.apiextensions.k8s.io/federatedclusterrolebindingplacements.primitives.federation.k8s.io created
customresourcedefinition.apiextensions.k8s.io/federatedclusterrolebindingoverrides.primitives.federation.k8s.io created
F0303 11:10:24.698934    9946 enable.go:117] error: Error creating FederatedTypeConfig "clusterrolebindings.rbac.authorization.k8s.io": FederatedTypeConfig.core.federation.k8s.io "clusterrolebindings.rbac.authorization.k8s.io" is invalid: []: Invalid value: map[string]interface {}{"apiVersion":"core.federation.k8s.io/v1alpha1", "metadata":map[string]interface {}{"uid":"f17d4541-3da4-11e9-969c-fa163e5c3838", "selfLink":"", "name":"clusterrolebindings.rbac.authorization.k8s.io", "creationTimestamp":"2019-03-03T11:10:24Z", "namespace":"federation-system", "generation":1}, "spec":map[string]interface {}{"target":map[string]interface {}{"group":"rbac.authorization.k8s.io", "version":"v1", "kind":"ClusterRoleBinding", "pluralName":"clusterrolebindings"}, "namespaced":false, "comparisonField":"ResourceVersion", "propagationEnabled":true, "template":map[string]interface {}{"group":"primitives.federation.k8s.io", "version":"v1alpha1", "kind":"FederatedClusterRoleBinding", "pluralName":"federatedclusterrolebindings"}, "placement":map[string]interface {}{"version":"v1alpha1", "kind":"FederatedClusterRoleBindingPlacement", "pluralName":"federatedclusterrolebindingplacements", "group":"primitives.federation.k8s.io"}, "override":map[string]interface {}{"group":"primitives.federation.k8s.io", "version":"v1alpha1", "kind":"FederatedClusterRoleBindingOverride", "pluralName":"federatedclusterrolebindingoverrides"}}, "kind":"FederatedTypeConfig"}: validation failure list:
spec.federatedType in body is required
ubuntu@khaled-jumphost1:~/federation-v2$ kubefed2 version
kubefed2 version: version.Info{Version:"v0.0.5", GitCommit:"2dad52b4085f68650d9e3ca0464d13482a86c24f", GitTreeState:"clean", BuildDate:"2019-02-19T04:45:23Z", GoVersion:"go1.11.2", Compiler:"gc", Platform:"linux/amd64"}
ubuntu@khaled-jumphost1:~/federation-v2$ kubectl version
Client Version: version.Info{Major:"", Minor:"", GitVersion:"v0.0.0-master+$Format:%h$", GitCommit:"10ecc6db83fd47a93eb0940e2e4434f2b0a5c3ec", GitTreeState:"clean", BuildDate:"2018-08-15T20:45:20Z", GoVersion:"go1.10.2", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.3", GitCommit:"a4529464e4629c21224b3d52edfe0ea91b072862", GitTreeState:"clean", BuildDate:"2018-09-09T17:53:03Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"linux/amd64"}
ubuntu@khaled-jumphost1:~/federation-v2$ kubectl -n federation-system describe federatedclusters
Name:         cluster1
Namespace:    federation-system
Labels:       <none>
Annotations:  <none>
API Version:  core.federation.k8s.io/v1alpha1
Kind:         FederatedCluster
Metadata:
  Creation Timestamp:  2019-03-03T11:05:38Z
  Generation:          1
  Resource Version:    101167
  Self Link:           /apis/core.federation.k8s.io/v1alpha1/namespaces/federation-system/federatedclusters/cluster1
  UID:                 46de4e3e-3da4-11e9-969c-fa163e5c3838
Spec:
  Cluster Ref:
    Name:  cluster1
  Secret Ref:
    Name:  cluster1-hxhhd
Status:
  Conditions:
    Last Probe Time:       2019-03-03T11:21:08Z
    Last Transition Time:  2019-03-03T11:05:44Z
    Message:               /healthz responded with ok
    Reason:                ClusterReady
    Status:                True
    Type:                  Ready
Events:                    <none>

Name:         cluster2
Namespace:    federation-system
Labels:       <none>
Annotations:  <none>
API Version:  core.federation.k8s.io/v1alpha1
Kind:         FederatedCluster
Metadata:
  Creation Timestamp:  2019-03-03T11:05:47Z
  Generation:          1
  Resource Version:    101168
  Self Link:           /apis/core.federation.k8s.io/v1alpha1/namespaces/federation-system/federatedclusters/cluster2
  UID:                 4c13140d-3da4-11e9-969c-fa163e5c3838
Spec:
  Cluster Ref:
    Name:  cluster2
  Secret Ref:
    Name:  cluster2-8tpzp
Status:
  Conditions:
    Last Probe Time:       2019-03-03T11:21:08Z
    Last Transition Time:  2019-03-03T11:06:25Z
    Message:               /healthz responded with ok
    Reason:                ClusterReady
    Status:                True
    Type:                  Ready
Events:                    <none>

/kind bug

yamt commented 5 years ago

it seems that your kubefed2 binary is older than the server.

khaledjendi commented 5 years ago

kubefed2 Do you think I should change the kubectl to an older version? I can see GoVersion:"go1.11.2" in kubefed2 and kubectl GitVersion:"v1.11.3"

yamt commented 5 years ago

i guess:

khaledjendi commented 5 years ago

Generated error:

ubuntu@khaled-jumphost1:~/federation-v2$ kubefed2 enable ClusterRoleBinding
customresourcedefinition.apiextensions.k8s.io/federatedclusterrolebindings.primitives.federation.k8s.io created
customresourcedefinition.apiextensions.k8s.io/federatedclusterrolebindingplacements.primitives.federation.k8s.io created
customresourcedefinition.apiextensions.k8s.io/federatedclusterrolebindingoverrides.primitives.federation.k8s.io created
F0303 11:10:24.698934    9946 enable.go:117] error: Error creating FederatedTypeConfig "clusterrolebindings.rbac.authorization.k8s.io": FederatedTypeConfig.core.federation.k8s.io "clusterrolebindings.rbac.authorization.k8s.io" is invalid: []: Invalid value: map[string]interface {}{"apiVersion":"core.federation.k8s.io/v1alpha1", "metadata":map[string]interface {}{"uid":"f17d4541-3da4-11e9-969c-fa163e5c3838", "selfLink":"", "name":"clusterrolebindings.rbac.authorization.k8s.io", "creationTimestamp":"2019-03-03T11:10:24Z", "namespace":"federation-system", "generation":1}, "spec":map[string]interface {}{"target":map[string]interface {}{"group":"rbac.authorization.k8s.io", "version":"v1", "kind":"ClusterRoleBinding", "pluralName":"clusterrolebindings"}, "namespaced":false, "comparisonField":"ResourceVersion", "propagationEnabled":true, "template":map[string]interface {}{"group":"primitives.federation.k8s.io", "version":"v1alpha1", "kind":"FederatedClusterRoleBinding", "pluralName":"federatedclusterrolebindings"}, "placement":map[string]interface {}{"version":"v1alpha1", "kind":"FederatedClusterRoleBindingPlacement", "pluralName":"federatedclusterrolebindingplacements", "group":"primitives.federation.k8s.io"}, "override":map[string]interface {}{"group":"primitives.federation.k8s.io", "version":"v1alpha1", "kind":"FederatedClusterRoleBindingOverride", "pluralName":"federatedclusterrolebindingoverrides"}}, "kind":"FederatedTypeConfig"}: validation failure list:
spec.federatedType in body is required
marun commented 5 years ago

@jSchnitzer1 That error seems to indicate that the version of the federation API you are using is less than v0.0.6. You will need to deploy a v0.0.6 control plane to use kubefed2 v0.0.6. kubfed2 as of v0.0.6 expects FederatedTypeConfig to have the federatedType field added in that release.

marun commented 5 years ago

I don't think this issue is actionable. Please feel free to reopen if you still need assistance or contact me on #sig-multicluster in kubernetes.slack.com.