Skip to content

Commit 53f9b7f

Browse files
authored
fix: external-dns cluster role didn't have permission to perform acti… (#260)
* fix: external-dns cluster role didn't have permission to perform actions against the newer version of the ingress resource * docs: update cert-manager docs * fix: upgrade provider in remote-state terraform to prevent errors due to old syntax with new provider versions * fix: typo
1 parent bc955d3 commit 53f9b7f

File tree

5 files changed

+61
-29
lines changed

5 files changed

+61
-29
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ infrastructure:
7373
EC2 instance sizing can be configured in [templates/terraform/environments/stage/main.tf](templates/terraform/environments/stage/main.tf)
7474

7575
## Other links
76-
Project board: [zenhub][zenhub-board]
76+
[Project board](https://github.com/orgs/commitdev/projects/6/views/2)
7777

7878
<!-- Links -->
7979
[zero]: https://github.com/commitdev/zero
@@ -83,6 +83,5 @@ Project board: [zenhub][zenhub-board]
8383
<!-- External Links -->
8484
[aws-cli]: https://docs.aws.amazon.com/polly/latest/dg/setup-aws-cli.html
8585
[aws-route53]: https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/domain-register.html
86-
[zenhub-board]: https://app.zenhub.com/workspaces/commit-zero-5da8decc7046a60001c6db44/board?filterLogic=any&repos=203630543,247773730,257676371,258369081
8786
[sendgrid]: https://signup.sendgrid.com
8887
[sendgrid-apikey]: https://app.sendgrid.com/settings/api_keys

doc-site/docs/about/overview.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ sidebar_label: Overview
44
sidebar_position: 1
55
---
66

7-
The Zero-awk-eks stack is designed with scalability and maintainability in mind, this repo is a series of templates indented to be filled in with modules parameters, and executed by zero
7+
The Zero-awk-eks stack is designed with scalability and maintainability in mind, this repo is a series of templates indented to be filled in with modules parameters, and executed by zero
88
This is a [Zero][zero] module which sets up a
99
hosting environment on AWS running Kubernetes. It will generate terraform output
10-
which describes the environment mapped in this [architecture diagram][arch-diagram].
10+
which describes the environment mapped in this [architecture diagram][arch-diagram].
1111

12-
### **Resource List**:
12+
### **Resource List**:
1313
[Link][resource-list]
1414

1515
### **Prerequisites**
@@ -24,6 +24,9 @@ which describes the environment mapped in this [architecture diagram][arch-diagr
2424
_Optional Prerequisites_
2525
- [Sendgrid account][sendgrid] with developer [API key][sendgrid-apikey]: this will enable transactional email sending with simple API calls.
2626

27+
### Other links
28+
[Project board](https://github.com/orgs/commitdev/projects/6/views/2)
29+
2730

2831
<!-- Links -->
2932
[zero]: https://github.com/commitdev/zero
@@ -32,6 +35,5 @@ _Optional Prerequisites_
3235
<!-- External Links -->
3336
[aws-cli]: https://docs.aws.amazon.com/polly/latest/dg/setup-aws-cli.html
3437
[aws-route53]: https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/domain-register.html
35-
[zenhub-board]: https://app.zenhub.com/workspaces/commit-zero-5da8decc7046a60001c6db44/board?filterLogic=any&repos=203630543,247773730,257676371,258369081
3638
[sendgrid]: https://signup.sendgrid.com
37-
[sendgrid-apikey]: https://app.sendgrid.com/settings/api_keys
39+
[sendgrid-apikey]: https://app.sendgrid.com/settings/api_keys

doc-site/docs/components/kubernetes/cert-manager.md

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,36 @@ sidebar_position: 2
55
---
66

77
## Overview
8-
cert-manager is a native Kubernetes certificate management controller. It can help with issuing certificates from a variety of sources, such as Lets Encrypt and more.
8+
`cert-manager` is a native Kubernetes certificate management controller. It can help with issuing certificates from a variety of sources, such as [Let's Encrypt](https://letsencrypt.org) and more.
99

10-
For any ingresses that specify that they need TLS, cert-manager will automatically provision a certificate using Lets Encrypt, and handle renewing it automatically on a regular basis. Alongside external-dns, this allows you to make sure your new domains are always secured using HTTPS.
10+
For any ingresses that specify that they need TLS, `cert-manager` will automatically provision a certificate using Let's Encrypt, and handle renewing it automatically on a regular basis. Alongside [external-dns](https://github.com/kubernetes-sigs/external-dns), this allows you to make sure your new domains are always secured using HTTPS.
1111

1212
## How It Works
13-
The sub-component ingress-shim watches Ingress resources across your cluster. If it observes an Ingress with annotations described in the Supported Annotations section, it will ensure a Certificate resource with the name provided in the tls.secretName field and configured as described on the Ingress exists. For example:
13+
`cert-manager` watches `Ingress` resources across your cluster. If it observes an `Ingress` with one of it's annotations, it will ensure a Certificate resource with the name provided in the tls.secretName field exists. See the example below.
14+
15+
Zero sets up two `ClusterIssuer`s by default which provide different ways of verifying your certificates.
16+
- `clusterissuer-letsencrypt-production` uses the HTTP issuer, which requires Let's Encrypt to do an HTTP call to your service to verify it.
17+
- `clusterissuer-letsencrypt-production-dns` uses the DNS issuer, which creates a DNS record Let's Encrypt will check to verify that you own the domain.
18+
19+
:::note
20+
The name "production" in the clusterissuers refers to the fact that we are using the "production" version of Let's Encrypt, which is what we want in almost all cases unless we are testing Let's Encrypt itself.
21+
:::
22+
23+
In the case of the HTTP `ClusterIssuer`, external-dns working properly will be required, since that is what will create a Route53 DNS record that points at the load balancer in front of your cluster. Both `external-dns` and `cert-manager` are configured by annotations and configuration in the `Ingress`.
24+
25+
26+
27+
## Example
1428

1529
```yaml
1630
apiVersion: networking.k8s.io/v1
1731
kind: Ingress
1832
metadata:
1933
annotations:
20-
# add an annotation indicating the issuer to use.
21-
cert-manager.io/cluster-issuer: nameOfClusterIssuer
34+
# This annotation is for cert-manager, it specifies which certificate issuer to use
35+
cert-manager.io/cluster-issuer: clusterissuer-letsencrypt-production
36+
# This annotation is for external-dns
37+
external-dns.alpha.kubernetes.io/hostname: example.com
2238
name: myIngress
2339
namespace: myIngress
2440
spec:
@@ -39,7 +55,8 @@ spec:
3955
secretName: myingress-cert # < cert-manager will store the created certificate in this secret.
4056
```
4157
58+
4259
## Documentation
43-
Checkout [Cert-manager's documentation][docs] for more information.
60+
Checkout [`cert-manager`'s documentation][docs] for more information.
4461

45-
[docs]: https://cert-manager.io/docs/
62+
[docs]: https://cert-manager.io/docs/

templates/kubernetes/terraform/modules/kubernetes/external_dns.tf

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,23 +56,18 @@ resource "kubernetes_cluster_role" "external_dns" {
5656
rule {
5757
verbs = ["get", "list", "watch"]
5858
api_groups = [""]
59-
resources = ["pods", "services"]
59+
resources = ["pods", "services", "endpoints"]
6060
}
6161
rule {
6262
verbs = ["get", "list", "watch"]
63-
api_groups = ["extensions"]
63+
api_groups = ["extensions", "networking.k8s.io"]
6464
resources = ["ingresses"]
6565
}
6666
rule {
67-
verbs = ["list"]
67+
verbs = ["list", "watch"]
6868
api_groups = [""]
6969
resources = ["nodes"]
7070
}
71-
rule {
72-
verbs = ["get", "list", "watch"]
73-
api_groups = [""]
74-
resources = ["endpoints"]
75-
}
7671
}
7772

7873
resource "kubernetes_cluster_role_binding" "external_dns" {

templates/terraform/bootstrap/remote-state/main.tf

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,40 @@
1+
terraform {
2+
required_version = ">= 0.14"
3+
required_providers {
4+
aws = {
5+
source = "hashicorp/aws"
6+
version = ">= 4.0.0"
7+
}
8+
}
9+
}
10+
111
provider "aws" {
212
region = "<% index .Params `region` %>"
313
allowed_account_ids = ["<% index .Params `accountId` %>"]
414
}
515

616
resource "aws_s3_bucket" "terraform_remote_state" {
717
bucket = "<% .Name %>-${var.environment}-terraform-state"
18+
}
19+
20+
resource "aws_s3_bucket_acl" "terraform_remote_state" {
21+
bucket = aws_s3_bucket.terraform_remote_state.id
822
acl = "private"
23+
}
924

10-
versioning {
11-
enabled = true
25+
resource "aws_s3_bucket_versioning" "terraform_remote_state" {
26+
bucket = aws_s3_bucket.terraform_remote_state.id
27+
versioning_configuration {
28+
status = "Enabled"
1229
}
30+
}
31+
32+
resource "aws_s3_bucket_server_side_encryption_configuration" "terraform_remote_state" {
33+
bucket = aws_s3_bucket.terraform_remote_state.id
1334

14-
server_side_encryption_configuration {
15-
rule {
16-
apply_server_side_encryption_by_default {
17-
sse_algorithm = "AES256"
18-
}
35+
rule {
36+
apply_server_side_encryption_by_default {
37+
sse_algorithm = "AES256"
1938
}
2039
}
2140
}

0 commit comments

Comments
 (0)