Change:
err = r.(error) } }() <del> fs.Parse(strings.Split(c.argc, " ")) </del> <ins> fs.Parse(strings.Split(tc.argc, " ")) </ins> }() <del> if c.expectErr && err == nil { </del> <ins> if tc.expectErr && err == nil { </ins> t.Errorf("did not observe an expected error") continue } <del> if !c.expectErr && err != nil { t.Errorf("observed an unexpected error") </del> <ins> if !tc.expectErr && err != nil { t.Errorf("observed an unexpected error: %v", err) </ins> continue } <del> if c.expectVal != ip { t.Errorf("unexpected ip: expected %q, saw %q", c.expectVal, ip) </del> <ins> if tc.expectVal != ip { t.Errorf("unexpected ip: expected %q, saw %q", tc.expectVal, ip) } } } func TestIPPortVar(t *testing.T) { defaultIPPort := "0.0.0.0:8080" testCases := []struct { desc      string argc      string expectErr bool expectVal string }{ { desc:      "valid ipv4 1", argc:      "blah --ipport=0.0.0.0", expectVal: "0.0.0.0", }, { desc:      "valid ipv4 2", argc:      "blah --ipport=127.0.0.1", expectVal: "127.0.0.1", }, { desc:      "invalid IP", argc:      "blah --ipport=invalidip", expectErr: true, expectVal: defaultIPPort, }, { desc:      "valid ipv4 with port", argc:      "blah --ipport=0.0.0.0:8080", expectVal: "0.0.0.0:8080", }, { desc:      "invalid ipv4 with invalid port", argc:      "blah --ipport=0.0.0.0:invalidport", expectErr: true, expectVal: defaultIPPort, }, { desc:      "invalid IP with port", argc:      "blah --ipport=invalidip:8080", expectErr: true, expectVal: defaultIPPort, }, { desc:      "valid ipv6 1", argc:      "blah --ipport=::1", expectVal: "::1", }, { desc:      "valid ipv6 2", argc:      "blah --ipport=::", expectVal: "::", }, { desc:      "valid ipv6 with port", argc:      "blah --ipport=[::1]:8080", expectVal: "[::1]:8080", }, { desc:      "invalid ipv6 with port without bracket", argc:      "blah --ipport=fd00:f00d:600d:f00d:8080", expectErr: true, expectVal: defaultIPPort, }, } for _, tc := range testCases { fs := pflag.NewFlagSet("blah", pflag.PanicOnError) ipport := defaultIPPort fs.Var(IPPortVar{&ipport}, "ipport", "the ip:port") var err error func() { defer func() { if r := recover(); r != nil { err = r.(error) } }() fs.Parse(strings.Split(tc.argc, " ")) }() if tc.expectErr && err == nil { t.Errorf("%q: Did not observe an expected error", tc.desc) continue } if !tc.expectErr && err != nil { t.Errorf("%q: Observed an unexpected error: %v", tc.desc, err) continue } if tc.expectVal != ipport { t.Errorf("%q: Unexpected ipport: expected %q, saw %q", tc.desc, tc.expectVal, ipport) </ins> } } }

Discussion:
Whenever I try to change kube proxy metrics bind using flag , it gives me: Then, I the port , the error changes. I expect the metrics server to listen to 0.0.0.0:. Do I miss something? Environment: Kubernetes version: v1.7.8 Cloud provider or hardware configuration**: on-premise OS (e.g. from /etc/os-release): debian/stretch Kernel (e.g. ): Linux R11U2-7U20N-1 4.9.0-3-amd64 SMP Debian 4.9.30-2+deb9u3 (2017-08-06) x86_64 GNU/Linux Install tools: Others:
/sig network /area kube-proxy
The is being and does NOT allow specifying a port. Have you tried using a config file? The field allows you to specify a port (an example ).
/assign
Turned out we use a wrong type when validating and . Sent for fixing this. Will try to cherrypick the fix as well.
New finding, is broken on HEAD in a different way: Seems to be introduced by
Humm..We have some default logic for : Seems like for some reason it does not auto append the default port number OR the validation happens before defaulting.
Issues go stale after 90d of inactivity. Mark the issue as fresh with . Stale issues rot after an additional 30d of inactivity and eventually close. Prevent issues from auto-closing with an comment. If this issue is safe to close now please do so with . Send feedback to sig-testing, kubernetes/test-infra and/or . /lifecycle stale
Stale issues rot after 30d of inactivity. Mark the issue as fresh with . Rotten issues close after an additional 30d of inactivity. If this issue is safe to close now please do so with . Send feedback to sig-testing, kubernetes/test-infra and/or . /lifecycle rotten /remove-lifecycle stale
/remove-lifecycle rotten
I got the same issue 0.0.0.0 0.0.0.0: both not work with kube-proxy 1.9.3 amd64
It is a BUG. Conflict between componentconfig.IPVar.Set(s string) and validation.validateHostPort.

Could you elaborate the issue a bit more? Which k8s version are you on?
I also meet the same issue with kubernetes 1.8. It's impossibe for Prometheus to fetch metrics from 127.0.0.1: in my case, any workaround? I think we'd better reopen this issue.
metrics binds to by default, are you trying to modify port as well? Thanks for reporting, I confirm the issue is remaining. (or any ip:port) does not work as intended even after the fix. Reopening this and filed a new issue for conflict kubeproxyconfig validation. /reopen
Thanks for reopening the issue. I want to bind metrics to 0.0.0.0: as well. With address 127.0.0.1:, Prometheus cannot pull metrics from this address unless they are on the same node.
is fixing this.
Issues go stale after 90d of inactivity. Mark the issue as fresh with . Stale issues rot after an additional 30d of inactivity and eventually close. If this issue is safe to close now please do so with . Send feedback to sig-testing, kubernetes/test-infra and/or . /lifecycle stale
/remove-lifecycle stale
Issues go stale after 90d of inactivity. Mark the issue as fresh with . Stale issues rot after an additional 30d of inactivity and eventually close. If this issue is safe to close now please do so with . Send feedback to sig-testing, kubernetes/test-infra and/or . /lifecycle stale
/remove-lifecycle stale (I just got bitten by this on kube-proxy v1.9.10)
should fix this.
Closing this as is merged. /close
Closing this issue. <detailsIn response to : Closing this as is merged. /close Instructions for interacting with me using PR comments are available . If you have questions or suggestions related to my behavior, please file an issue against the repository. </details