Scale static sites deployment to two replicas
kc scale --replicas=2 -n static-sites deploy/static-siteskube-proxy added these rules to load balance between them:
➜ sudo iptables -t nat -L KUBE-SERVICES -n -v | rg static-sites
0 0 KUBE-SVC-D3W7O6L4TBOTDF5H 6 -- * * 0.0.0.0/0 10.43.191.69 /* static-sites/static-sites:http cluster IP */ tcp dpt:80
~
➜ sudo iptables -t nat -L KUBE-SVC-D3W7O6L4TBOTDF5H -n -v
Chain KUBE-SVC-D3W7O6L4TBOTDF5H (1 references)
pkts bytes target prot opt in out source destination
0 0 KUBE-MARK-MASQ 6 -- * * !10.42.0.0/16 10.43.191.69 /* static-sites/static-sites:http cluster IP */ tcp dpt:80
0 0 KUBE-SEP-F47JVEZV36JZ7UAP 0 -- * * 0.0.0.0/0 0.0.0.0/0 /* static-sites/static-sites:http -> 10.42.0.224:8080 */ statistic mode random probability 0.50000000000
0 0 KUBE-SEP-TML3SZGGHMDHZV5V 0 -- * * 0.0.0.0/0 0.0.0.0/0 /* static-sites/static-sites:http -> 10.42.0.47:8080 */
~The first rule redirects traffic coming from outside the pod network to go back through the NAT. The next two rules do the load balancing:
statistic mode random probability 0.50000000000: 50% of the traffic- the next rule just gets the remainder (also 50%)