Kubernetes Service Proxy Concept: PublicIP

2/26/2015

I am trying to launch Guestbook.go example from kubernetes doc as follows:

https://github.com/GoogleCloudPlatform/kubernetes/tree/master/examples/guestbook-go

I have modified the guestbook-service.json in the above link to include PublicIPs

{
  "apiVersion": "v1beta1",
  "kind": "Service",
  "id": "guestbook",
  "port": 3000, 
  "containerPort": "http-server",
  "publicIPs": ["10.39.67.97","10.39.66.113"],
  "selector": { "name": "guestbook" }
}

I have one master and two minions as shown below:

centos-minion -> 10.39.67.97
centos-minion2 -> 10.39.66.113

I am using my publicIPs as my minions eth0 IP. But the iptables get created only on one of the minions:

[root@ip-10-39-67-97 ~]# iptables -L -n -t nat
Chain KUBE-PORTALS-HOST (1 references)
target     prot opt source               destination         
DNAT       tcp  --  0.0.0.0/0            10.254.208.93        /* redis-slave      */ tcp dpt:6379 to:10.39.67.240:56872
DNAT       tcp  --  0.0.0.0/0            10.254.223.192       /* guestbook */ tcp dpt:3000 to:10.39.67.240:58746
DNAT       tcp  --  0.0.0.0/0            10.39.67.97          /* guestbook */ tcp dpt:3000 to:10.39.67.240:58746
DNAT       tcp  --  0.0.0.0/0            10.39.66.113         /* guestbook */ tcp dpt:3000 to:10.39.67.240:58746
DNAT       tcp  --  0.0.0.0/0            10.254.0.2           /* kubernetes */ tcp dpt:443 to:10.39.67.240:33003
DNAT       tcp  --  0.0.0.0/0            10.254.0.1           /* kubernetes-ro */ tcp dpt:80 to:10.39.67.240:58434
DNAT       tcp  --  0.0.0.0/0            10.254.131.70        /* redis-master */ tcp dpt:6379 to:10.39.67.240:50754

So even if i redundancy with my Pods if i bring down the minion with that IPTABLE my external publicIP entry point dies.. I am sure i have conceptual misunderstanding.. Can anyone help

-- user3006942
centos
kubernetes

2 Answers

4/13/2017

You should use kubectl proxy  --accept-hosts='^*

#x27; --address='0.0.0.0' --port=8001 to expose your kube-proxy port to the public IP or internal iP

-- Karthik
Source: StackOverflow

3/9/2015

(sorry for the delay in answering your question)

PublicIPs are defined on every host node, so if you make sure that you round-robin packets into the host nodes from your external load balancer, (e.g. an edge router) then you can have redundancy, even if one of the host machines fails.

--brendan

-- brendan
Source: StackOverflow