Skip to content

Instantly share code, notes, and snippets.

@robscott
Last active April 19, 2020 21:59
Show Gist options
  • Select an option

  • Save robscott/4b64c46a3690aa55f53dd53f87f6e9c1 to your computer and use it in GitHub Desktop.

Select an option

Save robscott/4b64c46a3690aa55f53dd53f87f6e9c1 to your computer and use it in GitHub Desktop.
kube-proxy iptables probability

This shows the probabilities generated by kube-proxy 1.16 and rendered by iptables for the first 20 of 10k endpoints.

-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00009999983 -j KUBE-SEP-JPQESVWHRDCVFZWN
-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00009999983 -j KUBE-SEP-43X62NTQK7P33IRX
-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00009999983 -j KUBE-SEP-RO4MGPWQFAAAQSOM
-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00009999983 -j KUBE-SEP-U4U4WCN32VCO5JFK
-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00009999983 -j KUBE-SEP-C4TELCOQRZ66JRHV
-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00009999983 -j KUBE-SEP-ARSDZGCR5JG6RCWU
-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00009999983 -j KUBE-SEP-QN4E7AOM7AQ62UWM
-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00009999983 -j KUBE-SEP-3XQQML7Z2W4L2AIK
-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00009999983 -j KUBE-SEP-GWGL3MXCSQXY3MJ6
-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00009999983 -j KUBE-SEP-VR5HSYWIU4OQP4YP
-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00009999983 -j KUBE-SEP-XUILAAOUCIYUBFP4
-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00009999983 -j KUBE-SEP-KDHJXX4CJBXO2JW6
-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00009999983 -j KUBE-SEP-PZAJ4XI67QWBOA4E
-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00009999983 -j KUBE-SEP-Y73MNXZ2ZGPQDCFR
-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00009999983 -j KUBE-SEP-A5PURZK3OHPC6GM7
-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00009999983 -j KUBE-SEP-U7BU6XCG2RI65OSS
-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00009999983 -j KUBE-SEP-A5MGTD7NM6NDO3QR
-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00009999983 -j KUBE-SEP-G6MY3A4AGBT3TNO3
-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00009999983 -j KUBE-SEP-NSPZ7LBXPF6GURDT
-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00009999983 -j KUBE-SEP-WNTWIH6SSYVU6YMM

This shows the same 20 probabilities with this fix (note they're all unique values now).

-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00009999983 -j KUBE-SEP-JPQESVWHRDCVFZWN
-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00010001007 -j KUBE-SEP-43X62NTQK7P33IRX
-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00010001985 -j KUBE-SEP-RO4MGPWQFAAAQSOM
-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00010003010 -j KUBE-SEP-U4U4WCN32VCO5JFK
-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00010003988 -j KUBE-SEP-C4TELCOQRZ66JRHV
-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00010005012 -j KUBE-SEP-ARSDZGCR5JG6RCWU
-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00010005990 -j KUBE-SEP-QN4E7AOM7AQ62UWM
-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00010007014 -j KUBE-SEP-3XQQML7Z2W4L2AIK
-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00010007992 -j KUBE-SEP-GWGL3MXCSQXY3MJ6
-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00010009017 -j KUBE-SEP-VR5HSYWIU4OQP4YP
-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00010009995 -j KUBE-SEP-XUILAAOUCIYUBFP4
-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00010011019 -j KUBE-SEP-KDHJXX4CJBXO2JW6
-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00010011997 -j KUBE-SEP-PZAJ4XI67QWBOA4E
-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00010013022 -j KUBE-SEP-Y73MNXZ2ZGPQDCFR
-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00010013999 -j KUBE-SEP-A5PURZK3OHPC6GM7
-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00010015024 -j KUBE-SEP-U7BU6XCG2RI65OSS
-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00010016048 -j KUBE-SEP-A5MGTD7NM6NDO3QR
-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00010017026 -j KUBE-SEP-G6MY3A4AGBT3TNO3
-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00010018051 -j KUBE-SEP-NSPZ7LBXPF6GURDT
-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00010019029 -j KUBE-SEP-WNTWIH6SSYVU6YMM

It's worth noting that the values computed by kube-proxy are relatively round values, but due to iptables probability using a 2147483648 increment scale, they are rounded to these stranger looking values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment