Skip to content

Commit

Permalink
Fix DNS and certificate problems
Browse files Browse the repository at this point in the history
  • Loading branch information
pecigonzalo committed Oct 27, 2019
1 parent f2595dd commit 1a206b3
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ apply:
.PHONY: output
output:
TF_CLI_ARGS="" terraform output -json | tee certificates/nodes.json
tools/gen-kubeconfig.sh
cp .terraform/hosts.conf ansible/hosts.conf

.PHONY: certificates
certificates:
$(MAKE) -C certificates
tools/gen-kubeconfig.sh

.PHONY: ansible
ansible:
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ This repository is used to implement and follow [kubernetes-the-hard-way](https:
## TODO
- [ ] Add CNAME or similar static DNS or IPs to LB
- [ ] Set `ansible/group_vars/workers.yml` dynamically
- [ ] Set `certificates/Makefile` cert dynamically
2 changes: 1 addition & 1 deletion ansible/group_vars/workers.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ansible_ssh_common_args: "-J ubuntu@18.197.103.183"
ansible_ssh_common_args: "-J ubuntu@35.157.221.79"
2 changes: 2 additions & 0 deletions ansible/site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
name: "systemd-resolved"
daemon_reload: yes
state: restarted
- hostname:
name: "{{ inventory_hostname }}"

- name: Controller Certificates
tags:
Expand Down
1 change: 0 additions & 1 deletion ansible/templates/kubelet.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ ExecStart=/usr/local/bin/kubelet \
--kubeconfig=/var/lib/kubelet/kubeconfig \
--network-plugin=cni \
--register-node=true \
--hostname-override={{ HOSTNAME }} \
--v=2
Restart=on-failure
RestartSec=5
Expand Down
2 changes: 1 addition & 1 deletion certificates/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ kubernetes:
-ca=ca.pem \
-ca-key=ca-key.pem \
-config=ca-config.json \
-hostname=127.0.0.1,ec2-3-124-84-154.eu-central-1.compute.amazonaws.com,kubernetes,10.240.96.10,10.240.128.10,10.240.160.10,kubernetes.default,kubernetes.default.svc,kubernetes.default.svc.cluster,kubernetes.svc.cluster.local \
-hostname=127.0.0.1,ec2-3-121-135-18.eu-central-1.compute.amazonaws.com,kubernetes,10.240.96.10,10.240.128.10,10.240.160.10,kubernetes.default,kubernetes.default.svc,kubernetes.default.svc.cluster,kubernetes.svc.cluster.local,10.32.0.1,10.240.0.10,10.240.32.10,10.240.64.10 \
-profile=kubernetes \
kubernetes-csr.json | cfssljson -bare kubernetes

Expand Down
33 changes: 33 additions & 0 deletions terraform/dns.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,39 @@ resource "aws_route53_zone" "kttw" {
tags = "${module.lb_label.tags}"
}

resource "aws_route53_record" "ctrl-0" {
zone_id = "${aws_route53_zone.kttw.zone_id}"
name = "ctrl-0"
type = "CNAME"
ttl = "30"

records = [
"${module.ctrl-0.private_dns}",
]
}

resource "aws_route53_record" "ctrl-1" {
zone_id = "${aws_route53_zone.kttw.zone_id}"
name = "ctrl-1"
type = "CNAME"
ttl = "30"

records = [
"${module.ctrl-1.private_dns}",
]
}

resource "aws_route53_record" "ctrl-2" {
zone_id = "${aws_route53_zone.kttw.zone_id}"
name = "ctrl-2"
type = "CNAME"
ttl = "30"

records = [
"${module.ctrl-2.private_dns}",
]
}

resource "aws_route53_record" "wrkr-0" {
zone_id = "${aws_route53_zone.kttw.zone_id}"
name = "wrkr-0"
Expand Down

0 comments on commit 1a206b3

Please sign in to comment.