-
Notifications
You must be signed in to change notification settings - Fork 38.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cluster-loadbalancing addon #16232
Cluster-loadbalancing addon #16232
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Maintainers | ||
|
||
Prashanth.B <beeps@google.com> | ||
|
||
|
||
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/cluster/addons/cluster-loadbalancing/MAINTAINERS.md?pixel)]() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
# GCE Load-Balancer Controller (GLBC) Cluster Addon | ||
|
||
This cluster addon is composed of: | ||
* A [Google L7 LoadBalancer Controller](https://github.com/kubernetes/contrib/tree/master/Ingress/controllers/gce) | ||
* A [404 default backend](https://github.com/kubernetes/contrib/tree/master/404-server) Service + RC | ||
|
||
It relies on the [Ingress resource](../../../../docs/user-guide/ingress.md) only available in Kubernetes version 1.1 and beyond. | ||
|
||
## Quota | ||
|
||
GLBC is not aware of your GCE quota. As of this writing users get 3 [GCE Backend Services](https://cloud.google.com/compute/docs/load-balancing/http/backend-service) by default. If you plan on creating Ingresses for multiple Kubernetes Services, remember that each one requires a backend service, and request quota. Should you fail to do so the controller will poll periodically and grab the first free backend service slot it finds. You can view your quota: | ||
|
||
```console | ||
$ gcloud compute project-info describe --project myproject | ||
``` | ||
See [GCE documentation](https://cloud.google.com/compute/docs/resource-quotas#checking_your_quota) for how to request more. | ||
|
||
## Latency | ||
|
||
It takes ~1m to spin up a loadbalancer (this includes acquiring the public ip), and ~5-6m before the GCE api starts healthchecking backends. So as far as latency goes, here's what to expect: | ||
|
||
Assume one creates the following simple Ingress: | ||
```yaml | ||
apiVersion: extensions/v1beta1 | ||
kind: Ingress | ||
metadata: | ||
name: test-ingress | ||
spec: | ||
backend: | ||
# This will just loopback to the default backend of GLBC | ||
serviceName: default-http-backend | ||
servicePort: 80 | ||
``` | ||
|
||
* time, t=0 | ||
```console | ||
$ kubectl get ing | ||
NAME RULE BACKEND ADDRESS | ||
test-ingress - default-http-backend:80 | ||
$ kubectl describe ing | ||
No events. | ||
``` | ||
|
||
* time, t=1m | ||
```console | ||
$ kubectl get ing | ||
NAME RULE BACKEND ADDRESS | ||
test-ingress - default-http-backend:80 130.211.5.27 | ||
|
||
$ kubectl describe ing | ||
target-proxy: k8s-tp-default-test-ingress | ||
url-map: k8s-um-default-test-ingress | ||
backends: {"k8s-be-32342":"UNKNOWN"} | ||
forwarding-rule: k8s-fw-default-test-ingress | ||
Events: | ||
FirstSeen LastSeen Count From SubobjectPath Reason Message | ||
───────── ──────── ───── ──── ───────────── ────── ─────── | ||
46s 46s 1 {loadbalancer-controller } Success Created loadbalancer 130.211.5.27 | ||
``` | ||
|
||
* time, t=5m | ||
```console | ||
$ kubectl describe ing | ||
target-proxy: k8s-tp-default-test-ingress | ||
url-map: k8s-um-default-test-ingress | ||
backends: {"k8s-be-32342":"HEALTHY"} | ||
forwarding-rule: k8s-fw-default-test-ingress | ||
Events: | ||
FirstSeen LastSeen Count From SubobjectPath Reason Message | ||
───────── ──────── ───── ──── ───────────── ────── ─────── | ||
46s 46s 1 {loadbalancer-controller } Success Created loadbalancer 130.211.5.27 | ||
|
||
``` | ||
|
||
## Disabling GLBC | ||
|
||
Since GLBC runs as a cluster addon, you cannot simply delete the RC. The easiest way to disable it is to do as follows: | ||
|
||
* IFF you wat to tear down existing L7 loadbalancers, hit the /delete-all-and-quit endpoint on the pod: | ||
|
||
```console | ||
$ kubectl get pods --namespace=kube-system | ||
NAME READY STATUS RESTARTS AGE | ||
l7-lb-controller-7bb21 1/1 Running 0 1h | ||
$ kubectl exec l7-lb-controller-7bb21 -c l7-lb-controller curl http://localhost:8081/delete-all-and-quit --namespace=kube-system | ||
$ kubectl logs l7-lb-controller-7b221 -c l7-lb-controller --follow | ||
... | ||
I1007 00:30:00.322528 1 main.go:160] Handled quit, awaiting pod deletion. | ||
``` | ||
|
||
* Nullify the RC (but don't delete it or the addon controller will "fix" it for you) | ||
```console | ||
$ kubectl scale rc l7-lb-controller --replicas=0 --namespace=kube-system | ||
``` | ||
|
||
## Limitations | ||
|
||
* This cluster addon is still in the Beta phase. It behooves you to read through the GLBC documentation mentioned above and make sure there are no surprises. | ||
* The recommended way to tear down a cluster with active Ingresses is to either delete each Ingress, or hit the /delete-all-and-quit endpoint on GLBC as described below, before invoking a cluster teardown script (eg: kube-down.sh). You will have to manually cleanup GCE resources through the [cloud console](https://cloud.google.com/compute/docs/console#access) or [gcloud CLI](https://cloud.google.com/compute/docs/gcloud-compute/) if you simply tear down the cluster with active Ingresses. | ||
* All L7 Loadbalancers created by GLBC have a default backend. If you don't specify one in your Ingress, GLBC will assign the 404 default backend mentioned above. | ||
* All Kubernetes services must serve a 200 page on '/', or whatever custom value you've specified through GLBC's `--health-check-path argument`. | ||
* GLBC is not built for performance. Creating many Ingresses at a time can overwhelm it. It won't fall over, but will take its own time to churn through the Ingress queue. It doesn't understand concepts like fairness or backoff just yet. | ||
|
||
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/cluster/addons/cluster-loadbalancing/glbc/README.md?pixel)]() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
# This must match the --default-backend-service argument of the l7 lb | ||
# controller and is required because GCE mandates a default backend. | ||
name: default-http-backend | ||
namespace: kube-system | ||
labels: | ||
k8s-app: glbc | ||
kubernetes.io/cluster-service: "true" | ||
kubernetes.io/name: "GLBCDefaultBackend" | ||
spec: | ||
# The default backend must be of type NodePort. | ||
type: NodePort | ||
ports: | ||
- port: 80 | ||
targetPort: 8080 | ||
protocol: TCP | ||
name: http | ||
selector: | ||
k8s-app: glbc |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
apiVersion: v1 | ||
kind: ReplicationController | ||
metadata: | ||
name: l7-lb-controller | ||
namespace: kube-system | ||
labels: | ||
k8s-app: glbc | ||
version: v0.5 | ||
kubernetes.io/cluster-service: "true" | ||
kubernetes.io/name: "GLBC" | ||
spec: | ||
# There should never be more than 1 controller alive simultaneously. | ||
replicas: 1 | ||
selector: | ||
k8s-app: glbc | ||
version: v0.5 | ||
template: | ||
metadata: | ||
labels: | ||
k8s-app: glbc | ||
version: v0.5 | ||
name: glbc | ||
kubernetes.io/cluster-service: "true" | ||
spec: | ||
terminationGracePeriodSeconds: 600 | ||
containers: | ||
- name: default-http-backend | ||
# Any image is permissable as long as: | ||
# 1. It serves a 404 page at / | ||
# 2. It serves 200 on a /healthz endpoint | ||
image: gcr.io/google_containers/defaultbackend:1.0 | ||
livenessProbe: | ||
httpGet: | ||
path: /healthz | ||
port: 8080 | ||
scheme: HTTP | ||
initialDelaySeconds: 30 | ||
timeoutSeconds: 5 | ||
ports: | ||
- containerPort: 8080 | ||
resources: | ||
limits: | ||
cpu: 10m | ||
memory: 20Mi | ||
requests: | ||
cpu: 10m | ||
memory: 20Mi | ||
- image: gcr.io/google_containers/glbc:0.5 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. minor point: gclb is pretty obtuse. Is it harmful to say gce-l7-lb-controller or something? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. played around with it a bit and ended up with l7-lb-controller for the rc/container (figured the right controller would be on the right platform since this is an addon), and default-http-backend for the service, but leaving app: glbc as is. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I won't fight too hard, but glbc is prettttttttty terse.. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I too hate acronyms. Fortunately this is not in any actual interface against which anyone would write code. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wait, i renamed the rc/pod. the container can be nice and terse, i mean, pause. |
||
livenessProbe: | ||
httpGet: | ||
path: /healthz | ||
port: 8081 | ||
scheme: HTTP | ||
initialDelaySeconds: 30 | ||
timeoutSeconds: 5 | ||
name: l7-lb-controller | ||
resources: | ||
limits: | ||
cpu: 100m | ||
memory: 100Mi | ||
requests: | ||
cpu: 100m | ||
memory: 50Mi | ||
args: | ||
- --default-backend-service=kube-system/default-http-backend | ||
- --sync-period=300s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my concern is that users will run
get pods
and seeglbc
and have no idea what it is.