Skip to content

Commit 72db123

Browse files
committed
Merge pull request kubernetes#12480 from GoogleCloudPlatform/revert-12309-haproxy_gcr
Revert "Add multi cluster services documentation "
2 parents 9ddcfb7 + daf4ff4 commit 72db123

File tree

6 files changed

+8
-377
lines changed

6 files changed

+8
-377
lines changed

contrib/service-loadbalancer/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ all: push
22

33
# 0.0 shouldn't clobber any released builds
44
TAG = 0.0
5-
PREFIX = gcr.io/google_containers/servicelb
5+
PREFIX = bprashanth/servicelb
66

77
server: service_loadbalancer.go
88
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-w' -o service_loadbalancer ./service_loadbalancer.go
@@ -11,7 +11,7 @@ container: server
1111
docker build -t $(PREFIX):$(TAG) .
1212

1313
push: container
14-
gcloud docker push $(PREFIX):$(TAG)
14+
docker push $(PREFIX):$(TAG)
1515

1616
clean:
1717
rm -f service_loadbalancer

contrib/service-loadbalancer/README.md

Lines changed: 3 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,11 @@ __L7 load balancing of Http services__: The load balancer controller automatical
3232

3333
__L4 loadbalancing of Tcp services__: Since one needs to specify ports at pod creation time (kubernetes doesn't currently support port ranges), a single loadbalancer is tied to a set of preconfigured node ports, and hence a set of TCP services it can expose. The load balancer controller will dynamically add rules for each configured TCP service as it pops into existence. However, each "new" (unspecified in the tcpServices section of the loadbalancer.json) service will need you to open up a new container-host port pair for traffic. You can achieve this by creating a new loadbalancer pod with the `targetPort` set to the name of your service, and that service specified in the tcpServices map of the new loadbalancer.
3434

35+
3536
### Cross-cluster loadbalancing
3637

37-
On cloud providers that offer a private ip range for all instances on a network, you can setup multiple clusters in different availability zones, on the same network, and loadbalancer services across these zones. On GCE for example, every instance is a member of a single network. A network performs the same function that a router does: it defines the network range and gateway IP address, handles communication between instances, and serves as a gateway between instances and other networks. On such networks the endpoints of a service in one cluster are visible in all other clusters in the same network, so you can setup an edge loadbalancer that watches a kubernetes master of another cluster for services. Such a deployment allows you to fallback to a different AZ during times of duress or planned downtime (eg: database update).
38+
Still trying this out.
39+
3840

3941
### Examples
4042

@@ -186,95 +188,6 @@ $ mysql -u root -ppassword --host 104.197.63.17 --port 3306 -e 'show databases;'
186188
+--------------------+
187189
```
188190

189-
190-
#### Cross-cluster loadbalancing
191-
192-
First setup your 2 clusters, and a kubeconfig secret as described in the [sharing clusters example] (../../examples/sharing-clusters/README.md). We will create a loadbalancer in our first cluster (US) and have it publish the services from the second cluster (EU). This is the entire modified loadbalancer manifest:
193-
194-
```yaml
195-
apiVersion: v1
196-
kind: ReplicationController
197-
metadata:
198-
name: service-loadbalancer
199-
labels:
200-
app: service-loadbalancer
201-
version: v1
202-
spec:
203-
replicas: 1
204-
selector:
205-
app: service-loadbalancer
206-
version: v1
207-
template:
208-
metadata:
209-
labels:
210-
app: service-loadbalancer
211-
version: v1
212-
spec:
213-
volumes:
214-
# token from the eu cluster, must already exist
215-
# and match the name of the volume using in container
216-
- name: eu-config
217-
secret:
218-
secretName: kubeconfig
219-
nodeSelector:
220-
role: loadbalancer
221-
containers:
222-
- image: gcr.io/google_containers/servicelb:0.1
223-
imagePullPolicy: Always
224-
livenessProbe:
225-
httpGet:
226-
path: /healthz
227-
port: 8081
228-
scheme: HTTP
229-
initialDelaySeconds: 30
230-
timeoutSeconds: 5
231-
name: haproxy
232-
ports:
233-
# All http services
234-
- containerPort: 80
235-
hostPort: 80
236-
protocol: TCP
237-
# nginx https
238-
- containerPort: 443
239-
hostPort: 8080
240-
protocol: TCP
241-
# mysql
242-
- containerPort: 3306
243-
hostPort: 3306
244-
protocol: TCP
245-
# haproxy stats
246-
- containerPort: 1936
247-
hostPort: 1936
248-
protocol: TCP
249-
resources: {}
250-
args:
251-
- --tcp-services=mysql:3306,nginxsvc:443
252-
- --use-kubernetes-cluster-service=false
253-
# use-kubernetes-cluster-service=false in conjunction with the
254-
# kube/config will force the service-loadbalancer to watch for
255-
# services form the eu cluster.
256-
volumeMounts:
257-
- mountPath: /.kube
258-
name: eu-config
259-
env:
260-
- name: KUBECONFIG
261-
value: /.kube/config
262-
```
263-
264-
Note that it is essentially the same as the rc.yaml checked into the service-loadbalancer directory expect that it consumes the kubeconfig secret as an extra KUBECONFIG environment variable.
265-
266-
```cmd
267-
$ kubectl config use-context <us-clustername>
268-
$ kubectl create -f rc.yaml
269-
$ kubectl get pods -o wide
270-
service-loadbalancer-5o2p4 1/1 Running 0 13m kubernetes-minion-5jtd
271-
$ kubectl get node kubernetes-minion-5jtd -o json | grep -i externalip -A 2
272-
"type": "ExternalIP",
273-
"address": "104.197.81.116"
274-
$ curl http://104.197.81.116/nginxsvc
275-
Europe
276-
```
277-
278191
### Troubleshooting:
279192
- If you can curl or netcat the endpoint from the pod (with kubectl exec) and not from the node, you have not specified hostport and containerport.
280193
- If you can hit the ips from the node but not from your machine outside the cluster, you have not opened firewall rules for the right network.

contrib/service-loadbalancer/rc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ spec:
1919
nodeSelector:
2020
role: loadbalancer
2121
containers:
22-
- image: gcr.io/google_containers/servicelb:0.1
22+
- image: bprashanth/servicelb:0.0
2323
imagePullPolicy: Always
2424
livenessProbe:
2525
httpGet:

contrib/service-loadbalancer/template.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ backend {{$svc.Name}}
4848
balance roundrobin
4949
# TODO: Make the path used to access a service customizable.
5050
reqrep ^([^\ :]*)\ /{{$svc.Name}}[/]?(.*) \1\ /\2
51-
{{range $j, $ep := $svc.Ep}}server {{$svcName}}_{{$j}} {{$ep}}
51+
{{range $j, $ep := $svc.Ep}}server {{$svcName}}_{{$j}} {{$ep}} check
5252
{{end}}
5353
{{end}}
5454

@@ -64,6 +64,6 @@ frontend {{$svc.Name}}
6464
backend {{$svc.Name}}
6565
balance roundrobin
6666
mode tcp
67-
{{range $j, $ep := $svc.Ep}}server {{$svcName}}_{{$j}} {{$ep}}
67+
{{range $j, $ep := $svc.Ep}}server {{$svcName}}_{{$j}} {{$ep}} check
6868
{{end}}
6969
{{end}}

examples/sharing-clusters/README.md

Lines changed: 0 additions & 220 deletions
This file was deleted.

0 commit comments

Comments
 (0)