Skip to content

K8s Service cluster-ip is none when map host cluster service to vCluster service #1926

Open
@mayooot

Description

@mayooot

What happened?

When I create a vcluster and map the host cluster's service to vcluster, use the flowing file:

$ cat values.yaml
mapServices:
  fromHost:
  - from: web-namespace/nginx-service
    to: aps/nginx-service

Everything was working fine, but I find the vcluster service cluster-ip is none, so I tried to exec a pod and use nslookup to get the actual service ip.

$ vcluster connect my-vcluster-k8s -n team-x  -- kubectl get svc -A
NAMESPACE     NAME            TYPE        CLUSTER-IP        EXTERNAL-IP   PORT(S)                  AGE
default       kubernetes      ClusterIP   192.168.194.152   <none>        443/TCP                  28h
kube-system   kube-dns        ClusterIP   192.168.194.236   <none>        53/UDP,53/TCP,9153/TCP   28h
aps           nginx-service   ClusterIP   None              <none>        80/TCP                   28h

$ vcluster connect my-vcluster-k8s -n team-x  -- kubectl exec -it curl-pod -n aps -- bash

nslookup nginx-service.aps.svc.cluster.local
Server:   192.168.194.236
Address:  192.168.194.236#53

Name: nginx-service.aps.svc.cluster.local
Address: 192.168.194.242

Obviously, 192.168.194.242 is the real k8s service cluster ip.

k get svc -A | grep nginx-service
default                    nginx-service                              ClusterIP   192.168.194.186   <none>        80/TCP                          2d5h
web-namespace              nginx-service                              ClusterIP   192.168.194.242   <none>        80/TCP                          34h

So my question is, why not show the cluster-ip in the service of vcluster? Is a bug or is it something else?

What did you expect to happen?

vcluster can show real service cluster-ip when mapping the service

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

be like: https://www.vcluster.com/docs/v0.19/networking/internal_traffic/host_to_vcluster

Anything else we need to know?

No response

Host cluster Kubernetes version

$ vcluster connect my-vcluster-k8s -n team-x  -- kubectl version
Client Version: v1.30.2
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.29.0

vcluster version

$ vcluster version
vcluster version 0.20.0-beta.1

VCluster Config

use default config

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions