Skip to content

Commit 3235087

Browse files
authored
Merge pull request #197 from coreos/continued_stabilization
Stabilization and move toward 1.0
2 parents 98ee1d7 + 287a772 commit 3235087

File tree

15,497 files changed

+5345634
-7387
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

15,497 files changed

+5345634
-7387
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
all: container
2121

22-
TAG?=0.8
22+
TAG?=1.0-alpha.3
2323
PREFIX?=quay.io/coreos/alb-ingress-controller
2424
ARCH?=amd64
2525
TEMP_DIR:=$(shell mktemp -d)

README.md

Lines changed: 11 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,19 @@
44

55
# ALB Ingress Controller
66

7-
The ALB Ingress Controller satisfies Kubernetes [ingress resources](https://kubernetes.io/docs/user-guide/ingress) by provisioning [Application Load Balancers](https://aws.amazon.com/elasticloadbalancing/applicationloadbalancer) and [Route 53 Resource Record Sets](http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/rrsets-working-with.html).
7+
**NOTE:** This controller is in alpha state as we attempt to move to our first 1.0 release. The current image version is `1.0-alpha.3`. Please file any issues you find and note the version used.
8+
9+
The ALB Ingress Controller satisfies Kubernetes [ingress resources](https://kubernetes.io/docs/user-guide/ingress) by provisioning [Application Load Balancers](https://aws.amazon.com/elasticloadbalancing/applicationloadbalancer).
810

911
This project was originated by [Ticketmaster](https://github.com/ticketmaster) and [CoreOS](https://github.com/coreos) as part of Ticketmaster's move to AWS and CoreOS Tectonic. Learn more about Ticketmaster's Kubernetes initiative from Justin Dean's video at [Tectonic Summit](https://www.youtube.com/watch?v=wqXVKneP0Hg).
1012

13+
## Getting started
14+
15+
To get started with the controller, see our [walkthrough](docs/walkthrough.md).
16+
1117
## Design
1218

13-
The following diagram details the AWS components this controller creates. It also demonstrates the route ingress traffic takes from the DNS record to the Kubernetes cluster.
19+
The following diagram details the AWS components this controller creates. It also demonstrates the route ingress traffic takes from the ALB to the Kubernetes cluster.
1420

1521
![controller-design](docs/imgs/controller-design.png)
1622

@@ -32,8 +38,6 @@ using annotations.
3238

3339
**[5]**: [Rules](http://docs.aws.amazon.com/elasticloadbalancing/latest/application/listener-update-rules.html) are created for each path specified in your ingress resource. This ensures traffic to a specific path is routed to the correct Kubernetes Service.
3440

35-
**[6]**: A [Route 53 Resource Record Set](http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/rrsets-working-with.html) is created representing the domain of the ingress resource.
36-
3741
Along with the above, the controller also...
3842

3943
- deletes AWS components when ingress resources are removed from k8s.
@@ -45,35 +49,13 @@ Along with the above, the controller also...
4549

4650
This section details how traffic reaches the cluster.
4751

48-
As seen above, the ingress traffic for controller-managed resources starts at Route 53 DNS, moves
49-
through the ALB, and reaches the Kubernetes nodes through each service's NodePort. This means that
52+
As seen above, the ingress traffic for controller-managed resources starts at the ALB and reaches the Kubernetes nodes through each service's NodePort. This means that
5053
services referenced from ingress resource must be exposed on a node port in order to be to be
5154
reached by the ALB.
5255

53-
## Installation
54-
55-
The ALB Ingress Controller is installable via `kubectl` or `helm`. Follow one of the two options below to create a [Kubernetes deployment](https://kubernetes.io/docs/user-guide/deployments).
56-
57-
In order to start the controller, it must have appropriate access to AWS APIs. See [AWS API
58-
Access](docs/configuration.md#aws-api-access) for more information.
59-
60-
### kubectl Install
61-
62-
Deploy a default backend service.
63-
64-
```
65-
$ kubectl create -f https://raw.githubusercontent.com/coreos/alb-ingress-controller/master/examples/default-backend.yaml
66-
```
67-
68-
> Specifying a `--default-backend-service=` is required by Kubernetes ingress controllers. However, the ALB Ingress Controller does not make use of this service.
69-
70-
Deploy the ALB Ingress Controller.
71-
72-
```
73-
kubectl create -f https://raw.githubusercontent.com/coreos/alb-ingress-controller/master/examples/alb-ingress-controller.yaml
74-
```
56+
## Setup
7557

76-
> The `AWS_REGION` in the above example is set to `us-west-1`. Change this if your cluster is in a different region.
58+
For details on how to setup the controller and [external-dns](https://github.com/kubernetes-incubator/external-dnsexternal-dns) (for managing Route 53), see [setup](docs/setup.md).
7759

7860
### Helm App Reqistry Install
7961

docs/imgs/controller-design.png

-11.7 KB
Loading

docs/imgs/subnet-tags.png

38.1 KB
Loading

docs/ingress-resources.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,11 @@ The ALB Ingress Controller is configured by Annotations on the `Ingress` resourc
4040
### Required Annotations
4141

4242
```
43-
alb.ingress.kubernetes.io/security-groups
44-
alb.ingress.kubernetes.io/subnets
4543
alb.ingress.kubernetes.io/scheme
4644
```
4745
4846
Required annotations are:
4947
50-
- **security-groups**: Required. [Security groups](http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_SecurityGroups.html) that should be applied to the ALB instance. These can be referenced by security group IDs or the name tag associated with each security group. Example ID values are `sg-723a380a,sg-a6181ede,sg-a5181edd`. Example tag values are `appSG, webSG`.
51-
52-
- **subnets**: Required. The subnets where the ALB instance should be deployed. Must include 2 subnets, each in a different [availability zone](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html). These can be referenced by subnet IDs or the name tag associated with the subnet. Example values for subnet IDs are `subnet-a4f0098e,subnet-457ed533,subnet-95c904cd`. Example values for name tags are: `webSubnet,appSubnet`.
53-
5448
- **scheme**: Defines whether an ALB should be `internal` or `internet-facing`. See [Load balancer scheme](http://docs.aws.amazon.com/elasticloadbalancing/latest/userguide/how-elastic-load-balancing-works.html#load-balancer-scheme) in the AWS documentation for more details.
5549
5650
### Optional Annotations
@@ -66,6 +60,8 @@ alb.ingress.kubernetes.io/healthcheck-timeout-seconds
6660
alb.ingress.kubernetes.io/healthy-threshold-count
6761
alb.ingress.kubernetes.io/unhealthy-threshold-count
6862
alb.ingress.kubernetes.io/listen-ports
63+
alb.ingress.kubernetes.io/security-groups
64+
alb.ingress.kubernetes.io/subnets
6965
alb.ingress.kubernetes.io/successCodes
7066
alb.ingress.kubernetes.io/tags
7167
```
@@ -92,6 +88,16 @@ Optional annotations are:
9288
9389
- **listen-ports**: Defines the ports the ALB will expose. When omitted, `80` is used for HTTP and `443` is used for HTTPS. Uses a format as follows '[{"HTTP":8080,"HTTPS": 443}]'.
9490
91+
- **security-groups**: [Security groups](http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_SecurityGroups.html) that should be applied to the ALB instance. These can be referenced by security group IDs or the name tag associated with each security group. Example ID values are `sg-723a380a,sg-a6181ede,sg-a5181edd`. Example tag values are `appSG, webSG`. When the annotation is not present, the controller will create a security group with appropriate ports allowing access to `0.0.0.0/0` and attached to the ALB. It will also create a security group for instances that allows all TCP traffic when the source is the security group created for the ALB.
92+
93+
- **subnets**: The subnets where the ALB instance should be deployed. Must include 2 subnets, each in a different [availability zone](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html). These can be referenced by subnet IDs or the name tag associated with the subnet. Example values for subnet IDs are `subnet-a4f0098e,subnet-457ed533,subnet-95c904cd`. Example values for name tags are: `webSubnet,appSubnet`. If subnets are not specified the ALB controller will attempt to detect qualified subnets. This qualification is done by locating subnets that match the following criteria.
94+
95+
- kubernetes.io/cluster/$CLUSTER_NAME where $CLUSTER_NAME is the same cluster name specified on the ingress controller. The value of this tag must be 'shared'.
96+
97+
- kubernetes.io/role/alb-ingress the value of this tag should be empty.
98+
99+
- After subnets matching the above 2 tags have been located, they are checked to ensure 2 or more are in unique AZs, otherwise the ALB will not be created. If 2 subnets share the same AZ, only 1 of the 2 is used.
100+
95101
- **successCodes**: Defines the HTTP status code that should be expected when doing health checks against the defined `healthcheck-path`. When omitted, `200` is used.
96102
97103
- **tags**: Defines [AWS Tags](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html) that should be applied to the ALB instance and Target groups.

docs/setup.md

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
# Setup
2+
3+
This document describes how to setup the alb-ingress-controller using kubectl or helm. Additionally, it details how to setup [external-dns](https://github.com/kubernetes-incubator/external-dns) to work with the controller.
4+
5+
If you'd prefer an end-to-end walkthrough (example) of setup instead, see [the echoservice example](walkthrough.md).
6+
7+
## Prerequisites
8+
9+
This section details what must be setup in order for the controller to run.
10+
11+
### Role Permissions
12+
13+
Adequate roles and policies must be configured in AWS and available to the node(s) running the controller. How access is granted is up to you. Some will attach the needed rights to node's role in AWS. Others will use projects like [kube2iam](https://github.com/jtblin/kube2iam).
14+
15+
An example policy with the minimum rights can be found at [examples/iam-policy.json](../examples/iam-policy.json).
16+
17+
### Subnet Selection
18+
19+
The controller determines subnets to deploy each ALB to based on an annotation or auto-detection.
20+
21+
- annotation: `alb.ingress.kubernetes.io/subnets` may be specified in each ingress resource with the subnet IDs or `Name` tags. This allows for flexibility in where ALBs land. This list of subnets must include 2 or more that exist in unique availability zones. See the [annotations documentation](docs/ingress-resources.md#annotations) for more details.
22+
23+
- auto-detection: When subnet annotations are not present, the controller will attempt to choose the best subnets for deploying the ALBs. It uses the following tag criteria to determine the subnets it should use.
24+
25+
- `kubernetes.io/cluster/$CLUSTER_NAME`=`shared` where `$CLUSTER_NAME` matches the `CLUSTER_NAME` environment variable from the `alb-ingress-controller.yaml` manifest.
26+
27+
- `kubernetes.io/role/alb-ingress`=` ` where the value is empty.
28+
29+
### Security Group Selection
30+
31+
The controller determines if it should create and manage security groups or use existing ones in AWS based on the presence of an annotation. When `alb.ingress.kubernetes.io/security-groups` is present, the list of security groups is assigned to the ALB instance. When the annotation is not present, the controller will create a security group with appropriate ports allowing access to `0.0.0.0/0` and attached to the ALB. It will also create a security group for instances that allows all TCP traffic when the source is the security group created for the ALB.
32+
33+
## helm Deployments
34+
35+
You must have the [Helm App Registry plugin](https://coreos.com/apps) installed for these instructions to work.
36+
37+
```
38+
helm registry install quay.io/coreos/alb-ingress-controller-helm
39+
```
40+
41+
## kubectl Deployments
42+
43+
1. Setup default-backend-service
44+
45+
A default backend service is required for every ingress controller. The alb-ingress-controller does not make use of it, but will not be able to run the ingress libraries without it. To get around this, deploy a dummy default backend to the cluster. The following example will deploy one in `kube-system`; you may wish to adjust it.
46+
47+
```
48+
$ kubectl create -f https://raw.githubusercontent.com/coreos/alb-ingress-controller/master/examples/default-backend.yaml
49+
```
50+
51+
1. Configure the alb-ingress-controller manifest.
52+
53+
A sample manifest can be found below.
54+
55+
```
56+
$ wget https://raw.githubusercontent.com/coreos/alb-ingress-controller/master/examples/alb-ingress-controller.yaml
57+
```
58+
59+
At minimum, edit the following variables.
60+
61+
- `AWS_REGION`: region in AWS this cluster exists.
62+
63+
```yaml
64+
- name: AWS_REGION
65+
value: us-west-1
66+
```
67+
68+
- `CLUSTER_NAME`: name of the cluster. If doing auto-detection of subnets (described in prerequisites above) `CLUSTER_NAME` must match the AWS tags associated with the subnets you wish ALBs to be provisioned.
69+
70+
```yaml
71+
- name: CLUSTER_NAME
72+
value: devCluster
73+
```
74+
75+
1. Deploy the alb-ingress-controller manifest.
76+
77+
```
78+
$ kubectl apply -f alb-ingress-controller.yaml
79+
```
80+
81+
1. Verify the deployment was successful and the controller started.
82+
83+
```bash
84+
$ kubectl logs -n kube-system \
85+
$(kubectl get po -n kube-system | \
86+
egrep -o alb-ingress[a-zA-Z0-9-]+) | \
87+
egrep -o '\[ALB-INGRESS.*$'
88+
```
89+
90+
Should display output similar to the following.
91+
92+
```
93+
[ALB-INGRESS] [controller] [INFO]: Log level read as "", defaulting to INFO. To change, set LOG_LEVEL environment variable to WARN, ERROR, or DEBUG.
94+
[ALB-INGRESS] [controller] [INFO]: Ingress class set to alb
95+
[ALB-INGRESS] [ingresses] [INFO]: Build up list of existing ingresses
96+
[ALB-INGRESS] [ingresses] [INFO]: Assembled 0 ingresses from existing AWS resources
97+
```
98+
99+
## external-dns Deployment
100+
101+
[external-dns](https://github.com/kubernetes-incubator/external-dns) provisions DNS records based on the host information. This project will setup and manage records in Route 53 that point to controller deployed ALBs.
102+
103+
104+
1. Ensure your instance has the correct IAM permission required for external-dns. See https://github.com/kubernetes-incubator/external-dns/blob/master/docs/tutorials/aws.md#iam-permissions.
105+
106+
107+
1. Download external-dns to manage Route 53.
108+
109+
```bash
110+
$ wget https://raw.githubusercontent.com/coreos/alb-ingress-controller/master/examples/external-dns.yaml
111+
```
112+
113+
1. Edit the `--domain-filter` flag to include your hosted zone(s)
114+
115+
The following example is for a hosted zone test-dns.com
116+
117+
```yaml
118+
args:
119+
- --source=service
120+
- --source=ingress
121+
- --domain-filter=test-dns.com # will make ExternalDNS see only the hosted zones matching provided domain, omit to process all available hosted zones
122+
- --provider=aws
123+
- --policy=upsert-only # would prevent ExternalDNS from deleting any records, omit to enable full synchronization
124+
```
125+
126+
1. Deploy external-dns
127+
128+
```
129+
$ kubectl apply -f external-dns.yaml
130+
```
131+
132+
1. Verify it deployed successfully.
133+
134+
```
135+
$ kubectl logs -f -n kube-system (kubectl get po -n kube-system | egrep -o 'external-dns[A-Za-z0-9-]+')
136+
137+
time="2017-09-19T02:51:54Z" level=info msg="config: &{Master: KubeConfig: Sources:[service ingress] Namespace: FQDNTemplate: Compatibility: Provider:aws GoogleProject: DomainFilter:[] AzureConfigFile:/etc/kuberne tes/azure.json AzureResourceGroup: Policy:upsert-only Registry:txt TXTOwnerID:my-identifier TXTPrefix: Interval:1m0s Once:false DryRun:false LogFormat:text MetricsAddress::7979 Debug:false}"
138+
time="2017-09-19T02:51:54Z" level=info msg="Connected to cluster at https://10.3.0.1:443"
139+
```

0 commit comments

Comments
 (0)