Failed to install k8s provider using provider name : kubernetes
Swapnil-CSI opened this issue · 1 comments
Swapnil-CSI commented
What happened?
I tried to deploy k8s provider with provider name as kubernetes.
apiVersion: pkg.crossplane.io/v1
kind: Provider
metadata:
name: kubernetes
spec:
package: xpkg.upbound.io/crossplane-contrib/provider-kubernetes:v0.9.0
runtimeConfigRef:
apiVersion: pkg.crossplane.io/v1beta1
kind: DeploymentRuntimeConfig
name: kubernetes-provider
[swapnil@bharshankar crossplane]$ kubectl get providers.pkg
NAME INSTALLED HEALTHY PACKAGE AGE
kubernetes True False xpkg.upbound.io/crossplane-contrib/provider-kubernetes:v0.9.0 3s
[swapnil@bharshankar crossplane]$ kubectl get pods -n crossplane-system
NAME READY STATUS RESTARTS AGE
crossplane-66db6d559f-8ntzj 1/1 Running 0 3m10s
crossplane-rbac-manager-7d6f8d7b4b-tfgrr 1/1 Running 0 3m10s
kubernetes-fd7ab5be249e-64969bb97d-97dcs 0/1 CrashLoopBackOff 1 (8s ago) 9s
[swapnil@bharshankar crossplane]$
[swapnil@bharshankar crossplane]$ kubectl get svc -n crossplane-system
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
crossplane-webhooks ClusterIP 10.x.x.x <none> 9443/TCP 9m42s
kubernetes ClusterIP 10.x.x.x <none> 9443/TCP 6m43s
[swapnil@bharshankar crossplane]$
It showing below error in kubernetes-fd7ab5be249e-64969bb97d-97dcs pod.
[swapnil@bharshankar crossplane]$ kubectl -n crossplane-system logs kubernetes-fd7ab5be249e-64969bb97d-97dcs
2024-01-23T06:27:07.185Z ERROR Failed to get API Group-Resources {"error": "Get \"https://10.x.x.x:9443/api?timeout=32s\": dial tcp 10.x.x.x:9443: connect: connection refused"}
sigs.k8s.io/controller-runtime/pkg/cluster.New
sigs.k8s.io/controller-runtime@v0.14.6/pkg/cluster/cluster.go:161
sigs.k8s.io/controller-runtime/pkg/manager.New
sigs.k8s.io/controller-runtime@v0.14.6/pkg/manager/manager.go:351
main.main
github.com/crossplane-contrib/provider-kubernetes/cmd/provider/main.go:64
runtime.main
runtime/proc.go:250
crossplane-kubernetes-provider: error: Cannot create controller manager: Get "https://10.x.x.x:9443/api?timeout=32s": dial tcp 10.x.x.x:9443: connect: connection refused
[swapnil@bharshankar crossplane]$
How can we reproduce it?
install provider with name kubernetes
What environment did it happen in?
Crossplane version: 1.14.5
djeremiah commented
Provider deployments use the package name as the service name by default https://github.com/crossplane/crossplane/blob/master/internal/controller/pkg/revision/runtime.go#L267. Having a service named "kubernetes" shades the apiserver, and makes it so the provider can't start. This is not specific to provider-kubernetes. If you really want the provider to be named "kubernetes", you need to use the DeploymentRuntimeConfig to set the service name to something else:
apiVersion: pkg.crossplane.io/v1beta1
kind: DeploymentRuntimeConfig
metadata:
name: kubernetes-provider
spec:
serviceTemplate:
metadata:
name: something-other-than-kubernetes