Giter Club home page Giter Club logo

Comments (6)

mcluseau avatar mcluseau commented on July 20, 2024

I don't reproduce:

$ kubectl get svc -A
NAMESPACE     NAME         TYPE        CLUSTER-IP       EXTERNAL-IP                 PORT(S)         AGE
default       kubernetes   ClusterIP   192.168.48.1     <none>                      443/TCP         14m
default       nginx        ClusterIP   192.168.61.211   1.1.1.1,fd42:6b70:6e67::1   80/TCP          7m17s
kube-system   coredns      ClusterIP   192.168.48.2     <none>                      53/UDP,53/TCP   14m

$ dist/print-state 
I0827 14:15:46.901184  830085 client.go:168] connecting to 127.0.0.1:12090
# ------------------------------------------------------------------------
# 2021-08-27 14:15:46.902536054 +0200 CEST m=+0.002547050
#
&{Namespace:"default"  Name:"kubernetes"  Type:"ClusterIP"  IPs:{ClusterIPs:{V4:"192.168.48.1"}  ExternalIPs:{}}  Ports:{Name:"https"  Protocol:TCP  Port:443  TargetPort:6443} [IPs:{V4:"192.168.10.11"} IPs:{V4:"192.168.10.13"} IPs:{V4:"192.168.10.12"}]}
&{Namespace:"default"  Name:"nginx"  Type:"ClusterIP"  IPs:{ClusterIPs:{V4:"192.168.61.211"}  ExternalIPs:{V4:"1.1.1.1"  V6:"fd42:6b70:6e67::1"}}  Ports:{Protocol:TCP  Port:80  TargetPort:80} [IPs:{V4:"192.168.64.8"} IPs:{V4:"192.168.64.7"}]}
&{Namespace:"kube-system"  Name:"coredns"  Type:"ClusterIP"  IPs:{ClusterIPs:{V4:"192.168.48.2"}  ExternalIPs:{}}  Ports:{Name:"dns"  Protocol:UDP  Port:53  TargetPort:53}  Ports:{Name:"dns-tcp"  Protocol:TCP  Port:53  TargetPort:53} []}
^CI0827 14:15:50.068824  830085 client.go:154] got signal interrupt, stopping

$ dist/kpng-nodelog 
I0827 14:21:51.024722  830886 client.go:168] connecting to 127.0.0.1:12090
< req nwrk at 2021-08-27 14:21:51.02509846 +0200 CEST m=+0.003229086
< recv at 2021-08-27 14:21:51.025717988 +0200 CEST m=+0.003848624
+ Set:ServicesSet  Path:"default/kubernetes" -> Namespace:"default"  Name:"kubernetes"  Type:"ClusterIP"  IPs:{ClusterIPs:{V4:"192.168.48.1"}  ExternalIPs:{}}  Ports:{Name:"https"  Protocol:TCP  Port:443  TargetPort:6443}
+ Set:ServicesSet  Path:"default/nginx" -> Namespace:"default"  Name:"nginx"  Type:"ClusterIP"  IPs:{ClusterIPs:{V4:"192.168.61.211"}  ExternalIPs:{V4:"1.1.1.1"  V6:"fd42:6b70:6e67::1"}}  Ports:{Protocol:TCP  Port:80  TargetPort:80}
+ Set:ServicesSet  Path:"kube-system/coredns" -> Namespace:"kube-system"  Name:"coredns"  Type:"ClusterIP"  IPs:{ClusterIPs:{V4:"192.168.48.2"}  ExternalIPs:{}}  Ports:{Name:"dns"  Protocol:UDP  Port:53  TargetPort:53}  Ports:{Name:"dns-tcp"  Protocol:TCP  Port:53  TargetPort:53}
+ Set:EndpointsSet  Path:"default/kubernetes/23dfdcb0905ef710" -> IPs:{V4:"192.168.10.11"}
+ Set:EndpointsSet  Path:"default/kubernetes/6a431dea888d9999" -> IPs:{V4:"192.168.10.13"}
+ Set:EndpointsSet  Path:"default/kubernetes/f1658b843ad13c39" -> IPs:{V4:"192.168.10.12"}
+ Set:EndpointsSet  Path:"default/nginx/1b0af828d197f91d" -> IPs:{V4:"192.168.64.8"}
+ Set:EndpointsSet  Path:"default/nginx/1d4e3871514536fb" -> IPs:{V4:"192.168.64.7"}
> sync after 445.488µs

kpng api to-file gives this global state: global-state.yaml.gz

kubectl version gives:
Server Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.9", GitCommit:"7a576bc3935a6b555e33346fd73ad77c925e9e4a", GitTreeState:"clean", BuildDate:"2021-07-15T20:56:38Z", GoVersion:"go1.15.14", Compiler:"gc", Platform:"linux/amd64"}

from kpng.

mcluseau avatar mcluseau commented on July 20, 2024

same with a LB:

$ kubectl get svc
NAME         TYPE           CLUSTER-IP       EXTERNAL-IP                 PORT(S)        AGE
kubernetes   ClusterIP      192.168.48.1     <none>                      443/TCP        23m
nginx        ClusterIP      192.168.61.211   1.1.1.1,fd42:6b70:6e67::1   80/TCP         15m
nginx-lb     LoadBalancer   192.168.51.238   1.1.1.2,fd42:6b70:6e67::2   80:30314/TCP   9s

$ dist/print-state 
I0827 14:24:04.662248  831232 client.go:168] connecting to 127.0.0.1:12090
# ------------------------------------------------------------------------
# 2021-08-27 14:24:04.663607811 +0200 CEST m=+0.002311830
#
&{Namespace:"default"  Name:"kubernetes"  Type:"ClusterIP"  IPs:{ClusterIPs:{V4:"192.168.48.1"}  ExternalIPs:{}}  Ports:{Name:"https"  Protocol:TCP  Port:443  TargetPort:6443} [IPs:{V4:"192.168.10.11"} IPs:{V4:"192.168.10.13"} IPs:{V4:"192.168.10.12"}]}
&{Namespace:"default"  Name:"nginx"  Type:"ClusterIP"  IPs:{ClusterIPs:{V4:"192.168.61.211"}  ExternalIPs:{V4:"1.1.1.1"  V6:"fd42:6b70:6e67::1"}}  Ports:{Protocol:TCP  Port:80  TargetPort:80} [IPs:{V4:"192.168.64.8"} IPs:{V4:"192.168.64.7"}]}
&{Namespace:"default"  Name:"nginx-lb"  Type:"LoadBalancer"  IPs:{ClusterIPs:{V4:"192.168.51.238"}  ExternalIPs:{V4:"1.1.1.2"  V6:"fd42:6b70:6e67::2"}}  Ports:{Protocol:TCP  Port:80  NodePort:30314  TargetPort:80} [IPs:{V4:"192.168.64.8"} IPs:{V4:"192.168.64.7"}]}
&{Namespace:"kube-system"  Name:"coredns"  Type:"ClusterIP"  IPs:{ClusterIPs:{V4:"192.168.48.2"}  ExternalIPs:{}}  Ports:{Name:"dns"  Protocol:UDP  Port:53  TargetPort:53}  Ports:{Name:"dns-tcp"  Protocol:TCP  Port:53  TargetPort:53} []}

from kpng.

uablrek avatar uablrek commented on July 20, 2024

Strange... I wonder what the difference is in my cluster.

The external IPs are fond in svc.Status.LoadBalancer.Ingress[i] if set by a cloud-provider or the metallb controller (or assign-lb-ip that I use for test).

I made a grep and found "Ingress" only in backend/iptables.

kpng > grep -r Ingress .
./backends/iptables/service.go: for _, ing := range info.loadBalancerStatus.Ingress {
./backends/iptables/service.go: //TODO : CHECK Load Balancer Ingress IPs , service.Status.LoadBalancer.Ingress
./backends/iptables/service.go: // Obtain Load Balancer Ingress IPs
./backends/iptables/service.go: // for _, ing := range service.Status.LoadBalancer.Ingress {
./backends/iptables/service.go: //              info.loadBalancerStatus.Ingress = append(info.loadBalancerStatus.Ingress, v1.LoadBalancerIngress{IP: ip})

from kpng.

uablrek avatar uablrek commented on July 20, 2024

This is a bug.

ExternalIPs: localnetv1.NewIPSet(svc.Spec.ExternalIPs...),

Only svc.Spec.ExternalIPs are collected, but they are actually not recommended to be used and has been subject to many discussions. Basically external addresses shall not be specified by the used in the service manifest.

The external addresses are normally taken from service.Status.LoadBalancer.Ingress which is usually set by the cloud-provider or the metallb-controller, but not by the user.

For test I made a small test;

func lbIPs(svc *v1.Service) []string {
	ips := []string{}
	for _, i := range svc.Status.LoadBalancer.Ingress {
		ips = append(ips, i.IP)
	}
	return ips
}
// ....
			ExternalIPs: localnetv1.NewIPSet(lbIPs(svc)...),

The correct way would be to concat both svc.Spec.ExternalIPs and svc.Status.LoadBalancer.Ingress into ExternalIPs.

from kpng.

jayunit100 avatar jayunit100 commented on July 20, 2024

/close
and moved to #68

from kpng.

k8s-ci-robot avatar k8s-ci-robot commented on July 20, 2024

@jayunit100: Closing this issue.

In response to this:

/close
and moved to #68

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

from kpng.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.