loft-sh / vcluster

vCluster - Create fully functional virtual Kubernetes clusters - Each vcluster runs inside a namespace of the underlying k8s cluster. It's cheaper than creating separate full-blown clusters and it offers better multi-tenancy and isolation than regular namespaces.
https://www.vcluster.com
Apache License 2.0
6.92k stars 426 forks source link

Kubeconfig data gives me TLS error #2226

Closed emoreth closed 1 month ago

emoreth commented 1 month ago

What happened?

I was unable to pinpoint where this changed in the code. But it happened from alpha.10 to alpha.11.

The vc-CLUSTER_NAME secret used to have (alpha.10) these 4 keys:

After v.11 it now it has

The new token key is empty and the certificate-authority was removed.

In the config key, the certificate-authority-data was removed from clusters[0] and now I get TLS error when trying to connect to my vcluster with

Unable to connect to the server: tls: failed to verify certificate: x509: certificate signed by unknown authority

What did you expect to happen?

Be able to connect to the cluster

How can we reproduce it (as minimally and precisely as possible)?

Migrate from alpha.10 to alpha.11 (still present on beta.2)

Anything else we need to know?

No response

Host cluster Kubernetes version

```console Client Version: v1.30.0 Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3 Server Version: v1.29.8-eks-a737599 ```

vcluster version

```console $ vcluster --version # paste output here ```

VCluster Config

``` # My vcluster.yaml / values.yaml here ```
ThomasK33 commented 1 month ago

Hey @emoreth, thanks for opening an issue.

That seems strange, given that vCluster creates or patches the secret on startup and that the CA cert was not removed from the secret's data in the code.

https://github.com/loft-sh/vcluster/blob/d524065f05d79ae009a6066a0a8d240198cb907b/pkg/util/kubeconfig/kubeconfig.go#L80-L84

Could you try one of the more recent betas?

If it still doesn't work, would you mind including your vCluster version and vcluster.yaml file?

emoreth commented 1 month ago

When I tried yesterday, that still happened on beta.2. I can try again with beta.3.

I'm was not using vcluster CLI for this test, I was running a pure helm deployment.

I see the code you highlighted, but I was not using the exportKubeConfig.secret setting, and even when using that, the result was the same.

Since the certificate-authority was not present on the vc-CLUSTER_NAME secret, I guess is that something is failing while creating that secret, not while populating the kubeconfig.

ThomasK33 commented 1 month ago

Oh, thanks for that tidbit of info.

However, I will need more context and instructions for reproducing this issue.

Can you provide a list of commands you run that result in the secret not containing the CA data?

When I run the below steps locally, the secret contains the CA data.

vcluster on ī‚  main [$] via šŸ³ orbstack via šŸ¹ v1.23.2
āÆ kubectl create namespace team-x
namespace/team-x created

vcluster on ī‚  main [$] via šŸ³ orbstack via šŸ¹ v1.23.2
āÆ helm upgrade --install my-vcluster vcluster --repo https://charts.loft.sh --namespace team-x --version 0.21.0-beta.3
Release "my-vcluster" does not exist. Installing it now.
NAME: my-vcluster
LAST DEPLOYED: Tue Oct 15 17:20:09 2024
NAMESPACE: team-x
STATUS: deployed
REVISION: 1
TEST SUITE: None

vcluster on ī‚  main [$] via šŸ³ orbstack via šŸ¹ v1.23.2 took 3s
āÆ kubectl get secret -n team-x vc-my-vcluster -o yaml
apiVersion: v1
data:
  certificate-authority: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURCVENDQWUyZ0F3SUJBZ0lJZE5xS2swM1lFQ2d3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB5TkRFd01UVXhOVEl3TXpCYUZ3MHpOREV3TVRNeE5USXdNekJhTUJVeApFekFSQmdOVkJBTVRDbXQxWW1WeWJtVjBaWE13Z2dFaU1BMEdDU3FHU0liM0RRRUJBUVVBQTRJQkR3QXdnZ0VLCkFvSUJBUURxS1JHTzVmL0s2SHoxS0VYcVdsa2VLN2Jva3V0UGkyNGJSSDI0MHE2ZFpmV1QrU1hLaG9ja0krUU0KUFRMMXZiNUlQelFmMmVEQm9lTTRGRktrc0xKa055RTVuWGY5ajlkd2p4UjIrYWZmSit2Q1h5a3dMUHg2d0RZbgpCK1JpSVl0aHR6bFZqbllQYlNmV3RJMG5JMmZGWnM4cG5JS0FSVVBGNTFGOVNIRnI5VnRDcmNudGJxRlgvMHBHCmszUkN1aDZucDk0R3d0eGxGaytEcVVEZXhLcWx1eEtRVmk2WXVpaE5DeE9kRGJOYVhjSlRlSHZicVd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M2RVVlVhMmczU0VRdmR6VnljQXBVWVVGWlJVSlVWa042Wkc1TlVFa3dTMUpzV1ZWTVJ6aEdMMlZwVDNSUFJHSjBVVlZZUmtjMk4ycHFOVTUyZGtOSGJERlNNM1JVT0Znd2FFa3lZa2RXQ2xKQ1J6UklVVXRDWjFGRFYxUTNWRzV0V2twNGFqTnNablZITTJWU1kxTnJSV3BVY0VwMmRWcFRVeXRTTDNsNmVqUkNVVWh6U2t4SWVuTlpPVmgxUm1rS2VWVjNlVW81T1dGRU5HaFBkVVJzV0ZOVmRWUjROemtyTjJ4V2RWRjRhRGhwYkZaMWFXUTVkbU0yZG1WU1ZqWnpPWEZpVEhKNGMyOUJaRFJRYUV4ak1BcG1aekpSTlhWNU1XRTJkMDh3TDJOTFdFcG9ObWxvU3pSclVqRnVMMVUxV1ZSS1ZpOXlNRGcxUWtaUU9WTkJhMVJOUjBGb1NVRTlQUW90TFMwdExVVk9SQ0JTVTBFZ1VGSkpWa0ZVUlNCTFJWa3RMUzB0TFFvPQo=
  token: ""
kind: Secret
metadata:
  creationTimestamp: "2024-10-15T15:20:40Z"
  name: vc-my-vcluster
  namespace: team-x
  ownerReferences:
  - apiVersion: v1
    controller: false
    kind: Service
    name: my-vcluster
    uid: 78969912-8525-4bad-b5f6-78398a45f536
  resourceVersion: "103464"
  uid: 4f89bddb-1914-450e-9ae5-3499910c1564
type: Opaque
emoreth commented 1 month ago

Host cluster is EKS 1.29

Values:

controlPlane:
  backingStore:
    database:
      embedded:
        enabled: true
  coredns:
    deployment:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: vcluster-install
                operator: In
                values:
                - 'yes'
    embedded: false
    enabled: true
  distro:
    k8s:
      enabled: true
      version: v1.29.6
  ingress:
    annotations:
      nginx.ingress.kubernetes.io/backend-protocol: HTTPS
      nginx.ingress.kubernetes.io/ssl-passthrough: 'true'
      nginx.ingress.kubernetes.io/ssl-redirect: 'true'
    enabled: true
    host: my.website.com
    pathType: Prefix
    spec:
      ingressClassName: nginx
  proxy:
    extraSANs:
    - my.website.com
  statefulSet:
    persistence:
      volumeClaim:
        retentionPolicy: Delete
        size: 5Gi
        storageClass: ceph-filesystem
    scheduling:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: sysbox-install
                operator: In
                values:
                - 'no'
exportKubeConfig:
  context: testv2
  insecure: false
  server: https://my.website.com
networking:
  advanced:
    fallbackHostCluster: false
rbac:
  clusterRole:
    extraRules:
    - apiGroups:
      - storage.k8s.io
      resources:
      - storageclasses
      verbs:
      - get
      - watch
      - list
sync:
  fromHost:
    storageClasses:
      enabled: false
  toHost:
    ingresses:
      enabled: true
    persistentVolumeClaims:
      enabled: true
    persistentVolumes:
      enabled: true

Helm command

helm upgrade testv2 /app/new-charts/testv2 -n dz--testorg0000000000000--testv200000000000000--1e4ca9d9023f983 --atomic --namespace vc--testorg0000000000000--testv200000000000000--1e4ca9d9023f983 --install --timeout 15m

Secret vc-testv2

apiVersion: v1
data:                                                                                                                                                                                                                                                 
  client-certificate: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1..........0FURS0tLS0tCg==
  client-key: LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQp.....gUFJJVkFURSBLRVktLS0tLQo=
  config: YXBpVmVyc2lvbjogdjEKY2x1c3RlcnM6Ci0gY2x1c3RlcjoK.......UzB0TFFvPQo=
  token: ""
kind: Secret
metadata:
  creationTimestamp: "2024-10-14T20:29:41Z"
  name: vc-testv2
  namespace: vc--testorg0000000000000--testv200000000000000--1e4ca9d9023f983
  ownerReferences:
  - apiVersion: v1
    controller: false
    kind: Service
    name: testv2
    uid: 021e7ef9-fbb4-4d5c-bbb1-da3fab28abbb
  resourceVersion: "111236861"
  uid: 575912ae-8b1c-4e16-8808-d5074b3ce2b6
type: Opaque

Decoded config

apiVersion: v1
clusters:
- cluster:
    server: https://my.website.com
  name: testv2
contexts:
- context:
    cluster: testv2
    user: testv2
  name: testv2
current-context: testv2
kind: Config
preferences: {}
users:
- name: testv2
  user:
    client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURJVENDQWdtZ0F3SUJBZ0lJQTRnT.....yT1htSWxKcUIzaUJJZ3MvZUE9PQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
    client-key-data: LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFcFFJQkFBS0NBUUVBdVl......VkFURSBLRVktLS0tLQo=

I can't give full output as I have to redact some values.

I now have a code workaround that adds that info to the secret, but if I run helm upgrade again without my code the certificate-authority-data goes away again.

ThomasK33 commented 1 month ago

Thanks for the details and the steps to reproduce.

The following snippet was the part that helped me reproduce it:

exportKubeConfig:
  context: testv2
  insecure: false
  server: https://my.website.com/

I've created a PR (#2231) that should fix this by adding the CA data when using exportKubeConfig.server.