mirror of
https://github.com/puppetmaster/typhoon.git
synced 2025-08-08 03:11:34 +02:00
Compare commits
67 Commits
Author | SHA1 | Date | |
---|---|---|---|
5196709fe0 | |||
ab72f1ab2d | |||
5ef4155e08 | |||
15c4b793c3 | |||
36ed53924f | |||
19de38b30d | |||
995824fa6d | |||
1c5ed84fc2 | |||
ca7d62720e | |||
26f8d76755 | |||
fdd6882a87 | |||
f82266ac8c | |||
7bcf2d7831 | |||
78bfff0afe | |||
a6de245d8a | |||
96afa6a531 | |||
a407ff72df | |||
f453c54956 | |||
3e34fb075b | |||
9bfb1c5faf | |||
99ab81f79c | |||
8703f2c3c5 | |||
078f084220 | |||
81a1ae38e6 | |||
5b06e0e869 | |||
b951aca66f | |||
9da3725738 | |||
fd12f3612b | |||
96b646cf6d | |||
b15c60fa2f | |||
db947537d1 | |||
c933bdfc26 | |||
21632c6674 | |||
74780fb09f | |||
b60a2ecdf7 | |||
4a7083d94a | |||
c20683067d | |||
dc436b8fe9 | |||
efb9a2d09a | |||
e8d586f3b3 | |||
b74f470701 | |||
45bc52d156 | |||
4d5f962d76 | |||
e7d805d9a4 | |||
d95bf2d1ea | |||
c42139beaa | |||
35c2763ab0 | |||
2067356ae9 | |||
8f412e2f09 | |||
4ef2eb7e6b | |||
99990e3cbb | |||
3c3708d58e | |||
0c45cd0f06 | |||
976452825e | |||
7bc5633c38 | |||
09eb236519 | |||
6db11d5908 | |||
cad12804c8 | |||
eaea4d37a2 | |||
457ad18daa | |||
f79568c02a | |||
10d4d9e565 | |||
2227f2cc62 | |||
a12833531e | |||
dcd6733649 | |||
1409bc62d8 | |||
8cb7fe48a1 |
101
CHANGES.md
101
CHANGES.md
@ -2,7 +2,106 @@
|
|||||||
|
|
||||||
Notable changes between versions.
|
Notable changes between versions.
|
||||||
|
|
||||||
## Latest
|
## v1.16.1
|
||||||
|
|
||||||
|
* Kubernetes [v1.16.1](https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG-1.16.md#v1161)
|
||||||
|
* Update etcd from v3.3.15 to [v3.4.1](https://github.com/etcd-io/etcd/releases/tag/v3.4.1)
|
||||||
|
* Update Calico from v3.8.2 to [v3.9.1](https://docs.projectcalico.org/v3.9/release-notes/)
|
||||||
|
* Add Terraform v0.12 variables types ([#553](https://github.com/poseidon/typhoon/pull/553), [#557](https://github.com/poseidon/typhoon/pull/557), [#560](https://github.com/poseidon/typhoon/pull/560), [#556](https://github.com/poseidon/typhoon/pull/556), [#562](https://github.com/poseidon/typhoon/pull/562))
|
||||||
|
* Deprecate `cluster_domain_suffix` variable
|
||||||
|
|
||||||
|
#### AWS
|
||||||
|
|
||||||
|
* Add `worker_node_labels` variable to set initial worker node labels ([#550](https://github.com/poseidon/typhoon/pull/550))
|
||||||
|
* Add `node_labels` variable to internal `workers` pool module ([#550](https://github.com/poseidon/typhoon/pull/550))
|
||||||
|
* For Fedora CoreOS, detect most recent AMI in the region
|
||||||
|
|
||||||
|
#### Azure
|
||||||
|
|
||||||
|
* Promote `networking` provider Calico VXLAN out of experimental (set `networking = "calico"`)
|
||||||
|
* Add `worker_node_labels` variable to set initial worker node labels ([#550](https://github.com/poseidon/typhoon/pull/550))
|
||||||
|
* Add `node_labels` variable to internal `workers` pool module ([#550](https://github.com/poseidon/typhoon/pull/550))
|
||||||
|
* Change `workers` module default `vm_type` to `Standard_DS1_v2` (followup to [#539](https://github.com/poseidon/typhoon/pull/539))
|
||||||
|
|
||||||
|
#### Bare-Metal
|
||||||
|
|
||||||
|
* For Fedora CoreOS, use new kernel, initrd, and raw paths ([#563](https://github.com/poseidon/typhoon/pull/563))
|
||||||
|
* Fix Terraform missing comma error ([#549](https://github.com/poseidon/typhoon/pull/549))
|
||||||
|
* Remove deprecated `container_linux_oem` variable ([#562](https://github.com/poseidon/typhoon/pull/562))
|
||||||
|
|
||||||
|
#### DigitalOcean
|
||||||
|
|
||||||
|
* Promote `networking` provider Calico VXLAN out of experimental (set `networking = "calico"`)
|
||||||
|
* Fix Terraform missing comma error ([#549](https://github.com/poseidon/typhoon/pull/549))
|
||||||
|
|
||||||
|
#### Google Cloud
|
||||||
|
|
||||||
|
* Add `worker_node_labels` variable to set initial worker node labels ([#550](https://github.com/poseidon/typhoon/pull/550))
|
||||||
|
* Add `node_labels` variable to internal `workers` module ([#550](https://github.com/poseidon/typhoon/pull/550))
|
||||||
|
|
||||||
|
#### Addons
|
||||||
|
|
||||||
|
* Update Prometheus from v2.12.0 to [v2.13.0](https://github.com/prometheus/prometheus/releases/tag/v2.13.0)
|
||||||
|
* Fix Prometheus etcd target discovery and scraping ([#561](https://github.com/poseidon/typhoon/pull/561), regressed with Kubernetes v1.16.0)
|
||||||
|
* Update kube-state-metrics from v1.7.2 to v1.8.0
|
||||||
|
* Update nginx-ingress from v0.25.1 to [v0.26.1](https://github.com/kubernetes/ingress-nginx/releases/tag/nginx-0.26.1) ([#555](https://github.com/poseidon/typhoon/pull/555))
|
||||||
|
* Add lifecycle hook to allow draining for up to 5 minutes
|
||||||
|
* Update Grafana from v6.3.5 to [v6.4.1](https://github.com/grafana/grafana/releases/tag/v6.4.1)
|
||||||
|
|
||||||
|
## v1.16.0
|
||||||
|
|
||||||
|
* Kubernetes [v1.16.0](https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG-1.16.md#v1160) ([#543](https://github.com/poseidon/typhoon/pull/543))
|
||||||
|
* Read about several Kubernetes API [deprecations](https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG-1.16.md#deprecations-and-removals)!
|
||||||
|
* Remove legacy node role labels (no longer shown in `kubectl get nodes`)
|
||||||
|
* Rename node labels to `node.kubernetes.io/master` and `node.kubernetes.io/node` (migratory)
|
||||||
|
* Migrate control plane from self-hosted to static pods ([#536](https://github.com/poseidon/typhoon/pull/536))
|
||||||
|
* Run `kube-apiserver`, `kube-scheduler`, and `kube-controller-manager` as static pods on each controller
|
||||||
|
* `kubectl` edits to `kube-apiserver`, `kube-scheduler`, and `kube-controller-manager` are no longer possible (change)
|
||||||
|
* Remove bootkube, self-hosted pivot, and `pod-checkpointer`
|
||||||
|
* Update CoreDNS from v1.5.0 to v1.6.2 ([#535](https://github.com/poseidon/typhoon/pull/535))
|
||||||
|
* Update etcd from v3.3.15 to [v3.4.0](https://github.com/etcd-io/etcd/releases/tag/v3.4.0)
|
||||||
|
* Recommend updating `terraform-provider-ct` plugin from v0.3.2 to [v0.4.0](https://github.com/poseidon/terraform-provider-ct/releases/tag/v0.4.0)
|
||||||
|
|
||||||
|
#### Azure
|
||||||
|
|
||||||
|
* Change default `controller_type` to `Standard_B2s` ([#539](https://github.com/poseidon/typhoon/pull/539))
|
||||||
|
* `B2s` is cheaper by $17/month and provides 2 vCPU, 4GB RAM
|
||||||
|
* Change default `worker_type` to `Standard_DS1_v2` ([#539](https://github.com/poseidon/typhoon/pull/539))
|
||||||
|
* `F1` is previous generation. `DS1_v2` is newer, similar cost, and supports Low Priority mode
|
||||||
|
|
||||||
|
#### Addons
|
||||||
|
|
||||||
|
* Update Grafana from v6.3.3 to v6.3.5
|
||||||
|
|
||||||
|
## v1.15.3
|
||||||
|
|
||||||
|
* Kubernetes [v1.15.3](https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG-1.15.md#v1153)
|
||||||
|
* Update etcd from v3.3.13 to [v3.3.15](https://github.com/etcd-io/etcd/releases/tag/v3.3.15)
|
||||||
|
* Update Calico from v3.8.1 to [v3.8.2](https://docs.projectcalico.org/v3.8/release-notes/)
|
||||||
|
|
||||||
|
#### AWS
|
||||||
|
|
||||||
|
* Enable root block device encryption by default ([#527](https://github.com/poseidon/typhoon/pull/527))
|
||||||
|
* Require `terraform-provider-aws` v2.23+ (**action required**)
|
||||||
|
|
||||||
|
#### Addons
|
||||||
|
|
||||||
|
* Update Prometheus from v2.11.0 to [v2.12.0](https://github.com/prometheus/prometheus/releases/tag/v2.12.0)
|
||||||
|
* Update kube-state-metrics from v1.7.1 to v1.7.2
|
||||||
|
* Update Grafana from v6.2.5 to v6.3.3
|
||||||
|
* Use stable IDs for etcd, CoreDNS, and Nginx Ingress dashboards ([#530](https://github.com/poseidon/typhoon/pull/530))
|
||||||
|
* Update nginx-ingress from v0.25.0 to [v0.25.1](https://github.com/kubernetes/ingress-nginx/releases/tag/nginx-0.25.1)
|
||||||
|
* Fix Nginx security advisories
|
||||||
|
|
||||||
|
## v1.15.2
|
||||||
|
|
||||||
|
* Kubernetes [v1.15.2](https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG-1.15.md#v1152)
|
||||||
|
* Update Calico from v3.8.0 to [v3.8.1](https://docs.projectcalico.org/v3.8/release-notes/)
|
||||||
|
* Publish new load balancing, TCP/UDP, and firewall [docs](https://typhoon.psdn.io/architecture/aws/) ([#523](https://github.com/poseidon/typhoon/pull/523))
|
||||||
|
|
||||||
|
#### Addons
|
||||||
|
|
||||||
|
* Add new Grafana dashboards for CoreDNS and Nginx Ingress Controller ([#525](https://github.com/poseidon/typhoon/pull/525))
|
||||||
|
|
||||||
## v1.15.1
|
## v1.15.1
|
||||||
|
|
||||||
|
24
README.md
24
README.md
@ -1,4 +1,4 @@
|
|||||||
# Typhoon []() <img align="right" src="https://storage.googleapis.com/poseidon/typhoon-logo.png">
|
# Typhoon <img align="right" src="https://storage.googleapis.com/poseidon/typhoon-logo.png">
|
||||||
|
|
||||||
Typhoon is a minimal and free Kubernetes distribution.
|
Typhoon is a minimal and free Kubernetes distribution.
|
||||||
|
|
||||||
@ -11,7 +11,7 @@ Typhoon distributes upstream Kubernetes, architectural conventions, and cluster
|
|||||||
|
|
||||||
## Features <a href="https://www.cncf.io/certification/software-conformance/"><img align="right" src="https://storage.googleapis.com/poseidon/certified-kubernetes.png"></a>
|
## Features <a href="https://www.cncf.io/certification/software-conformance/"><img align="right" src="https://storage.googleapis.com/poseidon/certified-kubernetes.png"></a>
|
||||||
|
|
||||||
* Kubernetes v1.15.1 (upstream, via [kubernetes-incubator/bootkube](https://github.com/kubernetes-incubator/bootkube))
|
* Kubernetes v1.16.1 (upstream)
|
||||||
* Single or multi-master, [Calico](https://www.projectcalico.org/) or [flannel](https://github.com/coreos/flannel) networking
|
* Single or multi-master, [Calico](https://www.projectcalico.org/) or [flannel](https://github.com/coreos/flannel) networking
|
||||||
* On-cluster etcd with TLS, [RBAC](https://kubernetes.io/docs/admin/authorization/rbac/)-enabled, [network policy](https://kubernetes.io/docs/concepts/services-networking/network-policies/)
|
* On-cluster etcd with TLS, [RBAC](https://kubernetes.io/docs/admin/authorization/rbac/)-enabled, [network policy](https://kubernetes.io/docs/concepts/services-networking/network-policies/)
|
||||||
* Advanced features like [worker pools](https://typhoon.psdn.io/advanced/worker-pools/), [preemptible](https://typhoon.psdn.io/cl/google-cloud/#preemption) workers, and [snippets](https://typhoon.psdn.io/advanced/customization/#container-linux) customization
|
* Advanced features like [worker pools](https://typhoon.psdn.io/advanced/worker-pools/), [preemptible](https://typhoon.psdn.io/cl/google-cloud/#preemption) workers, and [snippets](https://typhoon.psdn.io/advanced/customization/#container-linux) customization
|
||||||
@ -48,7 +48,7 @@ Define a Kubernetes cluster by using the Terraform module for your chosen platfo
|
|||||||
|
|
||||||
```tf
|
```tf
|
||||||
module "google-cloud-yavin" {
|
module "google-cloud-yavin" {
|
||||||
source = "git::https://github.com/poseidon/typhoon//google-cloud/container-linux/kubernetes?ref=v1.15.1"
|
source = "git::https://github.com/poseidon/typhoon//google-cloud/container-linux/kubernetes?ref=v1.16.1"
|
||||||
|
|
||||||
# Google Cloud
|
# Google Cloud
|
||||||
cluster_name = "yavin"
|
cluster_name = "yavin"
|
||||||
@ -81,10 +81,10 @@ In 4-8 minutes (varies by platform), the cluster will be ready. This Google Clou
|
|||||||
```sh
|
```sh
|
||||||
$ export KUBECONFIG=/home/user/.secrets/clusters/yavin/auth/kubeconfig
|
$ export KUBECONFIG=/home/user/.secrets/clusters/yavin/auth/kubeconfig
|
||||||
$ kubectl get nodes
|
$ kubectl get nodes
|
||||||
NAME ROLES STATUS AGE VERSION
|
NAME ROLES STATUS AGE VERSION
|
||||||
yavin-controller-0.c.example-com.internal controller,master Ready 6m v1.15.1
|
yavin-controller-0.c.example-com.internal <none> Ready 6m v1.16.1
|
||||||
yavin-worker-jrbf.c.example-com.internal node Ready 5m v1.15.1
|
yavin-worker-jrbf.c.example-com.internal <none> Ready 5m v1.16.1
|
||||||
yavin-worker-mzdm.c.example-com.internal node Ready 5m v1.15.1
|
yavin-worker-mzdm.c.example-com.internal <none> Ready 5m v1.16.1
|
||||||
```
|
```
|
||||||
|
|
||||||
List the pods.
|
List the pods.
|
||||||
@ -97,16 +97,12 @@ kube-system calico-node-d1l5b 2/2 Running 0
|
|||||||
kube-system calico-node-sp9ps 2/2 Running 0 6m
|
kube-system calico-node-sp9ps 2/2 Running 0 6m
|
||||||
kube-system coredns-1187388186-zj5dl 1/1 Running 0 6m
|
kube-system coredns-1187388186-zj5dl 1/1 Running 0 6m
|
||||||
kube-system coredns-1187388186-dkh3o 1/1 Running 0 6m
|
kube-system coredns-1187388186-dkh3o 1/1 Running 0 6m
|
||||||
kube-system kube-apiserver-zppls 1/1 Running 0 6m
|
kube-system kube-apiserver-controller-0 1/1 Running 0 6m
|
||||||
kube-system kube-controller-manager-3271970485-gh9kt 1/1 Running 0 6m
|
kube-system kube-controller-manager-controller-0 1/1 Running 0 6m
|
||||||
kube-system kube-controller-manager-3271970485-h90v8 1/1 Running 1 6m
|
|
||||||
kube-system kube-proxy-117v6 1/1 Running 0 6m
|
kube-system kube-proxy-117v6 1/1 Running 0 6m
|
||||||
kube-system kube-proxy-9886n 1/1 Running 0 6m
|
kube-system kube-proxy-9886n 1/1 Running 0 6m
|
||||||
kube-system kube-proxy-njn47 1/1 Running 0 6m
|
kube-system kube-proxy-njn47 1/1 Running 0 6m
|
||||||
kube-system kube-scheduler-3895335239-5x87r 1/1 Running 0 6m
|
kube-system kube-scheduler-controller-0 1/1 Running 0 6m
|
||||||
kube-system kube-scheduler-3895335239-bzrrt 1/1 Running 1 6m
|
|
||||||
kube-system pod-checkpointer-l6lrt 1/1 Running 0 6m
|
|
||||||
kube-system pod-checkpointer-l6lrt-controller-0 1/1 Running 0 6m
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Non-Goals
|
## Non-Goals
|
||||||
|
1036
addons/grafana/dashboards-coredns.yaml
Normal file
1036
addons/grafana/dashboards-coredns.yaml
Normal file
@ -0,0 +1,1036 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: grafana-dashboards-coredns
|
||||||
|
namespace: monitoring
|
||||||
|
data:
|
||||||
|
coredns.json: |-
|
||||||
|
{
|
||||||
|
"__inputs": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"__requires": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"annotations": {
|
||||||
|
"list": [
|
||||||
|
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"description": "CoreDNS",
|
||||||
|
"editable": false,
|
||||||
|
"gnetId": null,
|
||||||
|
"graphTooltip": 0,
|
||||||
|
"hideControls": false,
|
||||||
|
"id": null,
|
||||||
|
"links": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"refresh": "",
|
||||||
|
"rows": [
|
||||||
|
{
|
||||||
|
"collapse": false,
|
||||||
|
"collapsed": false,
|
||||||
|
"panels": [
|
||||||
|
{
|
||||||
|
"aliasColors": {
|
||||||
|
|
||||||
|
},
|
||||||
|
"bars": false,
|
||||||
|
"dashLength": 10,
|
||||||
|
"dashes": false,
|
||||||
|
"datasource": "$datasource",
|
||||||
|
"fill": 1,
|
||||||
|
"gridPos": {
|
||||||
|
|
||||||
|
},
|
||||||
|
"id": 2,
|
||||||
|
"legend": {
|
||||||
|
"alignAsTable": false,
|
||||||
|
"avg": false,
|
||||||
|
"current": false,
|
||||||
|
"max": false,
|
||||||
|
"min": false,
|
||||||
|
"rightSide": false,
|
||||||
|
"show": "true",
|
||||||
|
"total": false,
|
||||||
|
"values": "true"
|
||||||
|
},
|
||||||
|
"lines": true,
|
||||||
|
"linewidth": 2,
|
||||||
|
"links": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"nullPointMode": "null",
|
||||||
|
"percentage": false,
|
||||||
|
"pointradius": 5,
|
||||||
|
"points": false,
|
||||||
|
"renderer": "flot",
|
||||||
|
"repeat": null,
|
||||||
|
"seriesOverrides": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"spaceLength": 10,
|
||||||
|
"span": 4,
|
||||||
|
"stack": false,
|
||||||
|
"steppedLine": false,
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"expr": "sum(rate(coredns_dns_request_count_total{instance=~\"$instance\"}[5m])) by (proto)",
|
||||||
|
"format": "time_series",
|
||||||
|
"intervalFactor": 2,
|
||||||
|
"legendFormat": "{{proto}}",
|
||||||
|
"refId": "A"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"thresholds": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"timeFrom": null,
|
||||||
|
"timeShift": null,
|
||||||
|
"title": "Requests (proto)",
|
||||||
|
"tooltip": {
|
||||||
|
"shared": true,
|
||||||
|
"sort": 0,
|
||||||
|
"value_type": "individual"
|
||||||
|
},
|
||||||
|
"type": "graph",
|
||||||
|
"xaxis": {
|
||||||
|
"buckets": null,
|
||||||
|
"mode": "time",
|
||||||
|
"name": null,
|
||||||
|
"show": true,
|
||||||
|
"values": [
|
||||||
|
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"yaxes": [
|
||||||
|
{
|
||||||
|
"format": "rps",
|
||||||
|
"label": null,
|
||||||
|
"logBase": 1,
|
||||||
|
"max": null,
|
||||||
|
"min": null,
|
||||||
|
"show": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"format": "rps",
|
||||||
|
"label": null,
|
||||||
|
"logBase": 1,
|
||||||
|
"max": null,
|
||||||
|
"min": null,
|
||||||
|
"show": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"aliasColors": {
|
||||||
|
|
||||||
|
},
|
||||||
|
"bars": false,
|
||||||
|
"dashLength": 10,
|
||||||
|
"dashes": false,
|
||||||
|
"datasource": "$datasource",
|
||||||
|
"fill": 1,
|
||||||
|
"gridPos": {
|
||||||
|
|
||||||
|
},
|
||||||
|
"id": 3,
|
||||||
|
"legend": {
|
||||||
|
"alignAsTable": false,
|
||||||
|
"avg": false,
|
||||||
|
"current": false,
|
||||||
|
"max": false,
|
||||||
|
"min": false,
|
||||||
|
"rightSide": false,
|
||||||
|
"show": "true",
|
||||||
|
"total": false,
|
||||||
|
"values": "true"
|
||||||
|
},
|
||||||
|
"lines": true,
|
||||||
|
"linewidth": 2,
|
||||||
|
"links": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"nullPointMode": "null",
|
||||||
|
"percentage": false,
|
||||||
|
"pointradius": 5,
|
||||||
|
"points": false,
|
||||||
|
"renderer": "flot",
|
||||||
|
"repeat": null,
|
||||||
|
"seriesOverrides": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"spaceLength": 10,
|
||||||
|
"span": 4,
|
||||||
|
"stack": false,
|
||||||
|
"steppedLine": false,
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"expr": "sum(rate(coredns_dns_request_type_count_total{instance=~\"$instance\"}[5m])) by (type)",
|
||||||
|
"format": "time_series",
|
||||||
|
"intervalFactor": 2,
|
||||||
|
"legendFormat": "{{type}}",
|
||||||
|
"refId": "A"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"thresholds": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"timeFrom": null,
|
||||||
|
"timeShift": null,
|
||||||
|
"title": "Requests (type)",
|
||||||
|
"tooltip": {
|
||||||
|
"shared": true,
|
||||||
|
"sort": 0,
|
||||||
|
"value_type": "individual"
|
||||||
|
},
|
||||||
|
"type": "graph",
|
||||||
|
"xaxis": {
|
||||||
|
"buckets": null,
|
||||||
|
"mode": "time",
|
||||||
|
"name": null,
|
||||||
|
"show": true,
|
||||||
|
"values": [
|
||||||
|
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"yaxes": [
|
||||||
|
{
|
||||||
|
"format": "rps",
|
||||||
|
"label": null,
|
||||||
|
"logBase": 1,
|
||||||
|
"max": null,
|
||||||
|
"min": null,
|
||||||
|
"show": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"format": "rps",
|
||||||
|
"label": null,
|
||||||
|
"logBase": 1,
|
||||||
|
"max": null,
|
||||||
|
"min": null,
|
||||||
|
"show": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"aliasColors": {
|
||||||
|
|
||||||
|
},
|
||||||
|
"bars": false,
|
||||||
|
"dashLength": 10,
|
||||||
|
"dashes": false,
|
||||||
|
"datasource": "$datasource",
|
||||||
|
"fill": 1,
|
||||||
|
"gridPos": {
|
||||||
|
|
||||||
|
},
|
||||||
|
"id": 4,
|
||||||
|
"legend": {
|
||||||
|
"alignAsTable": false,
|
||||||
|
"avg": false,
|
||||||
|
"current": false,
|
||||||
|
"max": false,
|
||||||
|
"min": false,
|
||||||
|
"rightSide": false,
|
||||||
|
"show": "true",
|
||||||
|
"total": false,
|
||||||
|
"values": "true"
|
||||||
|
},
|
||||||
|
"lines": true,
|
||||||
|
"linewidth": 2,
|
||||||
|
"links": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"nullPointMode": "null",
|
||||||
|
"percentage": false,
|
||||||
|
"pointradius": 5,
|
||||||
|
"points": false,
|
||||||
|
"renderer": "flot",
|
||||||
|
"repeat": null,
|
||||||
|
"seriesOverrides": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"spaceLength": 10,
|
||||||
|
"span": 4,
|
||||||
|
"stack": false,
|
||||||
|
"steppedLine": false,
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"expr": "sum(rate(coredns_dns_request_count_total{instance=~\"$instance\"}[5m])) by (zone)",
|
||||||
|
"format": "time_series",
|
||||||
|
"intervalFactor": 2,
|
||||||
|
"legendFormat": "{{zone}}",
|
||||||
|
"refId": "A"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"thresholds": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"timeFrom": null,
|
||||||
|
"timeShift": null,
|
||||||
|
"title": "Requests (zone)",
|
||||||
|
"tooltip": {
|
||||||
|
"shared": true,
|
||||||
|
"sort": 0,
|
||||||
|
"value_type": "individual"
|
||||||
|
},
|
||||||
|
"type": "graph",
|
||||||
|
"xaxis": {
|
||||||
|
"buckets": null,
|
||||||
|
"mode": "time",
|
||||||
|
"name": null,
|
||||||
|
"show": true,
|
||||||
|
"values": [
|
||||||
|
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"yaxes": [
|
||||||
|
{
|
||||||
|
"format": "rps",
|
||||||
|
"label": null,
|
||||||
|
"logBase": 1,
|
||||||
|
"max": null,
|
||||||
|
"min": null,
|
||||||
|
"show": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"format": "rps",
|
||||||
|
"label": null,
|
||||||
|
"logBase": 1,
|
||||||
|
"max": null,
|
||||||
|
"min": null,
|
||||||
|
"show": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"repeat": null,
|
||||||
|
"repeatIteration": null,
|
||||||
|
"repeatRowId": null,
|
||||||
|
"showTitle": false,
|
||||||
|
"title": "Dashboard Row",
|
||||||
|
"titleSize": "h6",
|
||||||
|
"type": "row"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"collapse": false,
|
||||||
|
"collapsed": false,
|
||||||
|
"panels": [
|
||||||
|
{
|
||||||
|
"aliasColors": {
|
||||||
|
|
||||||
|
},
|
||||||
|
"bars": false,
|
||||||
|
"dashLength": 10,
|
||||||
|
"dashes": false,
|
||||||
|
"datasource": "$datasource",
|
||||||
|
"fill": 1,
|
||||||
|
"gridPos": {
|
||||||
|
|
||||||
|
},
|
||||||
|
"id": 5,
|
||||||
|
"legend": {
|
||||||
|
"alignAsTable": false,
|
||||||
|
"avg": false,
|
||||||
|
"current": false,
|
||||||
|
"max": false,
|
||||||
|
"min": false,
|
||||||
|
"rightSide": false,
|
||||||
|
"show": "true",
|
||||||
|
"total": false,
|
||||||
|
"values": false
|
||||||
|
},
|
||||||
|
"lines": true,
|
||||||
|
"linewidth": 2,
|
||||||
|
"links": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"nullPointMode": "null",
|
||||||
|
"percentage": false,
|
||||||
|
"pointradius": 5,
|
||||||
|
"points": false,
|
||||||
|
"renderer": "flot",
|
||||||
|
"repeat": null,
|
||||||
|
"seriesOverrides": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"spaceLength": 10,
|
||||||
|
"span": 6,
|
||||||
|
"stack": false,
|
||||||
|
"steppedLine": false,
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"expr": "histogram_quantile(0.99, sum(rate(coredns_dns_request_duration_seconds_bucket{instance=~\"$instance\"}[5m])) by (le))",
|
||||||
|
"format": "time_series",
|
||||||
|
"intervalFactor": 2,
|
||||||
|
"legendFormat": "99%",
|
||||||
|
"refId": "A"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"expr": "histogram_quantile(0.90, sum(rate(coredns_dns_request_duration_seconds_bucket{instance=~\"$instance\"}[5m])) by (le))",
|
||||||
|
"format": "time_series",
|
||||||
|
"intervalFactor": 2,
|
||||||
|
"legendFormat": "90%",
|
||||||
|
"refId": "B"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"expr": "histogram_quantile(0.50, sum(rate(coredns_dns_request_duration_seconds_bucket{instance=~\"$instance\"}[5m])) by (le))",
|
||||||
|
"format": "time_series",
|
||||||
|
"intervalFactor": 2,
|
||||||
|
"legendFormat": "50%",
|
||||||
|
"refId": "C"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"thresholds": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"timeFrom": null,
|
||||||
|
"timeShift": null,
|
||||||
|
"title": "Latency",
|
||||||
|
"tooltip": {
|
||||||
|
"shared": true,
|
||||||
|
"sort": 0,
|
||||||
|
"value_type": "individual"
|
||||||
|
},
|
||||||
|
"type": "graph",
|
||||||
|
"xaxis": {
|
||||||
|
"buckets": null,
|
||||||
|
"mode": "time",
|
||||||
|
"name": null,
|
||||||
|
"show": true,
|
||||||
|
"values": [
|
||||||
|
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"yaxes": [
|
||||||
|
{
|
||||||
|
"format": "s",
|
||||||
|
"label": null,
|
||||||
|
"logBase": 1,
|
||||||
|
"max": null,
|
||||||
|
"min": null,
|
||||||
|
"show": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"format": "s",
|
||||||
|
"label": null,
|
||||||
|
"logBase": 1,
|
||||||
|
"max": null,
|
||||||
|
"min": null,
|
||||||
|
"show": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"aliasColors": {
|
||||||
|
|
||||||
|
},
|
||||||
|
"bars": false,
|
||||||
|
"dashLength": 10,
|
||||||
|
"dashes": false,
|
||||||
|
"datasource": "$datasource",
|
||||||
|
"fill": 1,
|
||||||
|
"gridPos": {
|
||||||
|
|
||||||
|
},
|
||||||
|
"id": 6,
|
||||||
|
"legend": {
|
||||||
|
"alignAsTable": false,
|
||||||
|
"avg": false,
|
||||||
|
"current": false,
|
||||||
|
"max": false,
|
||||||
|
"min": false,
|
||||||
|
"rightSide": false,
|
||||||
|
"show": "true",
|
||||||
|
"total": false,
|
||||||
|
"values": false
|
||||||
|
},
|
||||||
|
"lines": true,
|
||||||
|
"linewidth": 2,
|
||||||
|
"links": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"nullPointMode": "null",
|
||||||
|
"percentage": false,
|
||||||
|
"pointradius": 5,
|
||||||
|
"points": false,
|
||||||
|
"renderer": "flot",
|
||||||
|
"repeat": null,
|
||||||
|
"seriesOverrides": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"spaceLength": 10,
|
||||||
|
"span": 6,
|
||||||
|
"stack": false,
|
||||||
|
"steppedLine": false,
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"expr": "sum(rate(coredns_dns_response_rcode_count_total{instance=~\"$instance\"}[5m])) by (rcode)",
|
||||||
|
"format": "time_series",
|
||||||
|
"intervalFactor": 2,
|
||||||
|
"legendFormat": "{{rcode}}",
|
||||||
|
"refId": "A"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"thresholds": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"timeFrom": null,
|
||||||
|
"timeShift": null,
|
||||||
|
"title": "Response Code",
|
||||||
|
"tooltip": {
|
||||||
|
"shared": true,
|
||||||
|
"sort": 0,
|
||||||
|
"value_type": "individual"
|
||||||
|
},
|
||||||
|
"type": "graph",
|
||||||
|
"xaxis": {
|
||||||
|
"buckets": null,
|
||||||
|
"mode": "time",
|
||||||
|
"name": null,
|
||||||
|
"show": true,
|
||||||
|
"values": [
|
||||||
|
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"yaxes": [
|
||||||
|
{
|
||||||
|
"format": "rps",
|
||||||
|
"label": null,
|
||||||
|
"logBase": 1,
|
||||||
|
"max": null,
|
||||||
|
"min": null,
|
||||||
|
"show": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"format": "rps",
|
||||||
|
"label": null,
|
||||||
|
"logBase": 1,
|
||||||
|
"max": null,
|
||||||
|
"min": null,
|
||||||
|
"show": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"repeat": null,
|
||||||
|
"repeatIteration": null,
|
||||||
|
"repeatRowId": null,
|
||||||
|
"showTitle": false,
|
||||||
|
"title": "Dashboard Row",
|
||||||
|
"titleSize": "h6",
|
||||||
|
"type": "row"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"collapse": false,
|
||||||
|
"collapsed": false,
|
||||||
|
"panels": [
|
||||||
|
{
|
||||||
|
"aliasColors": {
|
||||||
|
|
||||||
|
},
|
||||||
|
"bars": false,
|
||||||
|
"dashLength": 10,
|
||||||
|
"dashes": false,
|
||||||
|
"datasource": "$datasource",
|
||||||
|
"fill": 1,
|
||||||
|
"gridPos": {
|
||||||
|
|
||||||
|
},
|
||||||
|
"id": 7,
|
||||||
|
"legend": {
|
||||||
|
"alignAsTable": false,
|
||||||
|
"avg": false,
|
||||||
|
"current": false,
|
||||||
|
"max": false,
|
||||||
|
"min": false,
|
||||||
|
"rightSide": false,
|
||||||
|
"show": "true",
|
||||||
|
"total": false,
|
||||||
|
"values": false
|
||||||
|
},
|
||||||
|
"lines": true,
|
||||||
|
"linewidth": 2,
|
||||||
|
"links": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"nullPointMode": "null",
|
||||||
|
"percentage": false,
|
||||||
|
"pointradius": 5,
|
||||||
|
"points": false,
|
||||||
|
"renderer": "flot",
|
||||||
|
"repeat": null,
|
||||||
|
"seriesOverrides": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"spaceLength": 10,
|
||||||
|
"span": 6,
|
||||||
|
"stack": false,
|
||||||
|
"steppedLine": false,
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"expr": "histogram_quantile(0.99, sum(rate(coredns_dns_request_size_bytes_bucket{instance=~\"$instance\"}[5m])) by (le,proto))",
|
||||||
|
"format": "time_series",
|
||||||
|
"intervalFactor": 2,
|
||||||
|
"legendFormat": "%99",
|
||||||
|
"refId": "A"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"expr": "histogram_quantile(0.90, sum(rate(coredns_dns_request_size_bytes_bucket{instance=~\"$instance\"}[5m])) by (le,proto))",
|
||||||
|
"format": "time_series",
|
||||||
|
"intervalFactor": 2,
|
||||||
|
"legendFormat": "%90",
|
||||||
|
"refId": "B"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"expr": "histogram_quantile(0.50, sum(rate(coredns_dns_request_size_bytes_bucket{instance=~\"$instance\"}[5m])) by (le,proto))",
|
||||||
|
"format": "time_series",
|
||||||
|
"intervalFactor": 2,
|
||||||
|
"legendFormat": "%50",
|
||||||
|
"refId": "C"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"thresholds": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"timeFrom": null,
|
||||||
|
"timeShift": null,
|
||||||
|
"title": "Request Size",
|
||||||
|
"tooltip": {
|
||||||
|
"shared": true,
|
||||||
|
"sort": 0,
|
||||||
|
"value_type": "individual"
|
||||||
|
},
|
||||||
|
"type": "graph",
|
||||||
|
"xaxis": {
|
||||||
|
"buckets": null,
|
||||||
|
"mode": "time",
|
||||||
|
"name": null,
|
||||||
|
"show": true,
|
||||||
|
"values": [
|
||||||
|
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"yaxes": [
|
||||||
|
{
|
||||||
|
"format": "bytes",
|
||||||
|
"label": null,
|
||||||
|
"logBase": 1,
|
||||||
|
"max": null,
|
||||||
|
"min": null,
|
||||||
|
"show": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"format": "bytes",
|
||||||
|
"label": null,
|
||||||
|
"logBase": 1,
|
||||||
|
"max": null,
|
||||||
|
"min": null,
|
||||||
|
"show": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"aliasColors": {
|
||||||
|
|
||||||
|
},
|
||||||
|
"bars": false,
|
||||||
|
"dashLength": 10,
|
||||||
|
"dashes": false,
|
||||||
|
"datasource": "$datasource",
|
||||||
|
"fill": 1,
|
||||||
|
"gridPos": {
|
||||||
|
|
||||||
|
},
|
||||||
|
"id": 8,
|
||||||
|
"legend": {
|
||||||
|
"alignAsTable": false,
|
||||||
|
"avg": false,
|
||||||
|
"current": false,
|
||||||
|
"max": false,
|
||||||
|
"min": false,
|
||||||
|
"rightSide": false,
|
||||||
|
"show": "true",
|
||||||
|
"total": false,
|
||||||
|
"values": false
|
||||||
|
},
|
||||||
|
"lines": true,
|
||||||
|
"linewidth": 2,
|
||||||
|
"links": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"nullPointMode": "null",
|
||||||
|
"percentage": false,
|
||||||
|
"pointradius": 5,
|
||||||
|
"points": false,
|
||||||
|
"renderer": "flot",
|
||||||
|
"repeat": null,
|
||||||
|
"seriesOverrides": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"spaceLength": 10,
|
||||||
|
"span": 6,
|
||||||
|
"stack": false,
|
||||||
|
"steppedLine": false,
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"expr": "histogram_quantile(0.99, sum(rate(coredns_dns_response_size_bytes_bucket{instance=~\"$instance\"}[5m])) by (le,proto))",
|
||||||
|
"format": "time_series",
|
||||||
|
"intervalFactor": 2,
|
||||||
|
"legendFormat": "%99",
|
||||||
|
"refId": "A"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"expr": "histogram_quantile(0.90, sum(rate(coredns_dns_response_size_bytes_bucket{instance=~\"$instance\"}[5m])) by (le,proto))",
|
||||||
|
"format": "time_series",
|
||||||
|
"intervalFactor": 2,
|
||||||
|
"legendFormat": "%90",
|
||||||
|
"refId": "B"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"expr": "histogram_quantile(0.50, sum(rate(coredns_dns_response_size_bytes_bucket{instance=~\"$instance\"}[5m])) by (le,proto))",
|
||||||
|
"format": "time_series",
|
||||||
|
"intervalFactor": 2,
|
||||||
|
"legendFormat": "%50",
|
||||||
|
"refId": "C"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"thresholds": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"timeFrom": null,
|
||||||
|
"timeShift": null,
|
||||||
|
"title": "Response Size",
|
||||||
|
"tooltip": {
|
||||||
|
"shared": true,
|
||||||
|
"sort": 0,
|
||||||
|
"value_type": "individual"
|
||||||
|
},
|
||||||
|
"type": "graph",
|
||||||
|
"xaxis": {
|
||||||
|
"buckets": null,
|
||||||
|
"mode": "time",
|
||||||
|
"name": null,
|
||||||
|
"show": true,
|
||||||
|
"values": [
|
||||||
|
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"yaxes": [
|
||||||
|
{
|
||||||
|
"format": "bytes",
|
||||||
|
"label": null,
|
||||||
|
"logBase": 1,
|
||||||
|
"max": null,
|
||||||
|
"min": null,
|
||||||
|
"show": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"format": "bytes",
|
||||||
|
"label": null,
|
||||||
|
"logBase": 1,
|
||||||
|
"max": null,
|
||||||
|
"min": null,
|
||||||
|
"show": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"repeat": null,
|
||||||
|
"repeatIteration": null,
|
||||||
|
"repeatRowId": null,
|
||||||
|
"showTitle": false,
|
||||||
|
"title": "Dashboard Row",
|
||||||
|
"titleSize": "h6",
|
||||||
|
"type": "row"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"collapse": false,
|
||||||
|
"collapsed": false,
|
||||||
|
"panels": [
|
||||||
|
{
|
||||||
|
"aliasColors": {
|
||||||
|
|
||||||
|
},
|
||||||
|
"bars": false,
|
||||||
|
"dashLength": 10,
|
||||||
|
"dashes": false,
|
||||||
|
"datasource": "$datasource",
|
||||||
|
"fill": 1,
|
||||||
|
"gridPos": {
|
||||||
|
|
||||||
|
},
|
||||||
|
"id": 9,
|
||||||
|
"legend": {
|
||||||
|
"alignAsTable": false,
|
||||||
|
"avg": false,
|
||||||
|
"current": false,
|
||||||
|
"max": false,
|
||||||
|
"min": false,
|
||||||
|
"rightSide": false,
|
||||||
|
"show": "true",
|
||||||
|
"total": false,
|
||||||
|
"values": false
|
||||||
|
},
|
||||||
|
"lines": true,
|
||||||
|
"linewidth": 2,
|
||||||
|
"links": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"nullPointMode": "null",
|
||||||
|
"percentage": false,
|
||||||
|
"pointradius": 5,
|
||||||
|
"points": false,
|
||||||
|
"renderer": "flot",
|
||||||
|
"repeat": null,
|
||||||
|
"seriesOverrides": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"spaceLength": 10,
|
||||||
|
"span": 6,
|
||||||
|
"stack": false,
|
||||||
|
"steppedLine": false,
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"expr": "sum(coredns_cache_size{instance=~\"$instance\"}) by (type)",
|
||||||
|
"format": "time_series",
|
||||||
|
"intervalFactor": 2,
|
||||||
|
"legendFormat": "{{type}}",
|
||||||
|
"refId": "A"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"thresholds": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"timeFrom": null,
|
||||||
|
"timeShift": null,
|
||||||
|
"title": "Cache Size",
|
||||||
|
"tooltip": {
|
||||||
|
"shared": true,
|
||||||
|
"sort": 0,
|
||||||
|
"value_type": "individual"
|
||||||
|
},
|
||||||
|
"type": "graph",
|
||||||
|
"xaxis": {
|
||||||
|
"buckets": null,
|
||||||
|
"mode": "time",
|
||||||
|
"name": null,
|
||||||
|
"show": true,
|
||||||
|
"values": [
|
||||||
|
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"yaxes": [
|
||||||
|
{
|
||||||
|
"format": "short",
|
||||||
|
"label": null,
|
||||||
|
"logBase": 1,
|
||||||
|
"max": null,
|
||||||
|
"min": null,
|
||||||
|
"show": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"format": "short",
|
||||||
|
"label": null,
|
||||||
|
"logBase": 1,
|
||||||
|
"max": null,
|
||||||
|
"min": null,
|
||||||
|
"show": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"aliasColors": {
|
||||||
|
|
||||||
|
},
|
||||||
|
"bars": false,
|
||||||
|
"dashLength": 10,
|
||||||
|
"dashes": false,
|
||||||
|
"datasource": "$datasource",
|
||||||
|
"fill": 1,
|
||||||
|
"gridPos": {
|
||||||
|
|
||||||
|
},
|
||||||
|
"id": 10,
|
||||||
|
"legend": {
|
||||||
|
"alignAsTable": false,
|
||||||
|
"avg": false,
|
||||||
|
"current": false,
|
||||||
|
"max": false,
|
||||||
|
"min": false,
|
||||||
|
"rightSide": false,
|
||||||
|
"show": "true",
|
||||||
|
"total": false,
|
||||||
|
"values": false
|
||||||
|
},
|
||||||
|
"lines": true,
|
||||||
|
"linewidth": 2,
|
||||||
|
"links": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"nullPointMode": "null",
|
||||||
|
"percentage": false,
|
||||||
|
"pointradius": 5,
|
||||||
|
"points": false,
|
||||||
|
"renderer": "flot",
|
||||||
|
"repeat": null,
|
||||||
|
"seriesOverrides": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"spaceLength": 10,
|
||||||
|
"span": 6,
|
||||||
|
"stack": false,
|
||||||
|
"steppedLine": false,
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"expr": "sum(rate(coredns_cache_hits_total{instance=~\"$instance\"}[5m])) by (type)",
|
||||||
|
"format": "time_series",
|
||||||
|
"intervalFactor": 2,
|
||||||
|
"legendFormat": "{{type}} hits",
|
||||||
|
"refId": "A"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"expr": "sum(rate(coredns_cache_misses_total{instance=~\"$instance\"}[5m])) by (type)",
|
||||||
|
"format": "time_series",
|
||||||
|
"intervalFactor": 2,
|
||||||
|
"legendFormat": "{{type}} misses",
|
||||||
|
"refId": "B"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"thresholds": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"timeFrom": null,
|
||||||
|
"timeShift": null,
|
||||||
|
"title": "Cache Hit Rate",
|
||||||
|
"tooltip": {
|
||||||
|
"shared": true,
|
||||||
|
"sort": 0,
|
||||||
|
"value_type": "individual"
|
||||||
|
},
|
||||||
|
"type": "graph",
|
||||||
|
"xaxis": {
|
||||||
|
"buckets": null,
|
||||||
|
"mode": "time",
|
||||||
|
"name": null,
|
||||||
|
"show": true,
|
||||||
|
"values": [
|
||||||
|
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"yaxes": [
|
||||||
|
{
|
||||||
|
"format": "ops",
|
||||||
|
"label": null,
|
||||||
|
"logBase": 1,
|
||||||
|
"max": null,
|
||||||
|
"min": null,
|
||||||
|
"show": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"format": "ops",
|
||||||
|
"label": null,
|
||||||
|
"logBase": 1,
|
||||||
|
"max": null,
|
||||||
|
"min": null,
|
||||||
|
"show": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"repeat": null,
|
||||||
|
"repeatIteration": null,
|
||||||
|
"repeatRowId": null,
|
||||||
|
"showTitle": false,
|
||||||
|
"title": "Dashboard Row",
|
||||||
|
"titleSize": "h6",
|
||||||
|
"type": "row"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"schemaVersion": 14,
|
||||||
|
"style": "dark",
|
||||||
|
"tags": [
|
||||||
|
"coredns"
|
||||||
|
],
|
||||||
|
"templating": {
|
||||||
|
"list": [
|
||||||
|
{
|
||||||
|
"current": {
|
||||||
|
"text": "Prometheus",
|
||||||
|
"value": "Prometheus"
|
||||||
|
},
|
||||||
|
"hide": 0,
|
||||||
|
"label": null,
|
||||||
|
"name": "datasource",
|
||||||
|
"options": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"query": "prometheus",
|
||||||
|
"refresh": 1,
|
||||||
|
"regex": "",
|
||||||
|
"type": "datasource"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"allValue": null,
|
||||||
|
"current": {
|
||||||
|
|
||||||
|
},
|
||||||
|
"datasource": "$datasource",
|
||||||
|
"hide": 0,
|
||||||
|
"includeAll": true,
|
||||||
|
"label": null,
|
||||||
|
"multi": false,
|
||||||
|
"name": "instance",
|
||||||
|
"options": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"query": "label_values(coredns_build_info{job=\"coredns\"}, instance)",
|
||||||
|
"refresh": 2,
|
||||||
|
"regex": "",
|
||||||
|
"sort": 0,
|
||||||
|
"tagValuesQuery": "",
|
||||||
|
"tags": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"tagsQuery": "",
|
||||||
|
"type": "query",
|
||||||
|
"useTags": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"time": {
|
||||||
|
"from": "now-1h",
|
||||||
|
"to": "now"
|
||||||
|
},
|
||||||
|
"timepicker": {
|
||||||
|
"refresh_intervals": [
|
||||||
|
"5s",
|
||||||
|
"10s",
|
||||||
|
"30s",
|
||||||
|
"1m",
|
||||||
|
"5m",
|
||||||
|
"15m",
|
||||||
|
"30m",
|
||||||
|
"1h",
|
||||||
|
"2h",
|
||||||
|
"1d"
|
||||||
|
],
|
||||||
|
"time_options": [
|
||||||
|
"5m",
|
||||||
|
"15m",
|
||||||
|
"1h",
|
||||||
|
"6h",
|
||||||
|
"12h",
|
||||||
|
"24h",
|
||||||
|
"2d",
|
||||||
|
"7d",
|
||||||
|
"30d"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"timezone": "",
|
||||||
|
"title": "CoreDNS",
|
||||||
|
"uid": "2f3f749259235f58698ea949170d3bd5",
|
||||||
|
"version": 0
|
||||||
|
}
|
@ -1224,7 +1224,8 @@ data:
|
|||||||
"30d"
|
"30d"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"timezone": "browser",
|
"timezone": "",
|
||||||
"title": "etcd",
|
"title": "etcd",
|
||||||
|
"uid": "c2f4e12cdf69feb95caa41a5a1b423d9",
|
||||||
"version": 215
|
"version": 215
|
||||||
}
|
}
|
||||||
|
1059
addons/grafana/dashboards-nginx-ingress.yaml
Normal file
1059
addons/grafana/dashboards-nginx-ingress.yaml
Normal file
@ -0,0 +1,1059 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: grafana-dashboards-nginx-ingress
|
||||||
|
namespace: monitoring
|
||||||
|
data:
|
||||||
|
nginx.json: |-
|
||||||
|
{
|
||||||
|
"__inputs": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"__requires": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"annotations": {
|
||||||
|
"list": [
|
||||||
|
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"description": "Nginx Ingress Controller",
|
||||||
|
"editable": false,
|
||||||
|
"gnetId": null,
|
||||||
|
"graphTooltip": 0,
|
||||||
|
"hideControls": false,
|
||||||
|
"id": null,
|
||||||
|
"links": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"refresh": "",
|
||||||
|
"rows": [
|
||||||
|
{
|
||||||
|
"collapse": false,
|
||||||
|
"collapsed": false,
|
||||||
|
"panels": [
|
||||||
|
{
|
||||||
|
"cacheTimeout": null,
|
||||||
|
"colorBackground": false,
|
||||||
|
"colorValue": false,
|
||||||
|
"colors": [
|
||||||
|
"#299c46",
|
||||||
|
"rgba(237, 129, 40, 0.89)",
|
||||||
|
"#d44a3a"
|
||||||
|
],
|
||||||
|
"datasource": "$datasource",
|
||||||
|
"format": "rps",
|
||||||
|
"gauge": {
|
||||||
|
"maxValue": 100,
|
||||||
|
"minValue": 0,
|
||||||
|
"show": false,
|
||||||
|
"thresholdLabels": false,
|
||||||
|
"thresholdMarkers": true
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
|
||||||
|
},
|
||||||
|
"height": "100px",
|
||||||
|
"id": 2,
|
||||||
|
"interval": null,
|
||||||
|
"links": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"mappingType": 1,
|
||||||
|
"mappingTypes": [
|
||||||
|
{
|
||||||
|
"name": "value to text",
|
||||||
|
"value": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "range to text",
|
||||||
|
"value": 2
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"maxDataPoints": 100,
|
||||||
|
"nullPointMode": "connected",
|
||||||
|
"nullText": null,
|
||||||
|
"postfix": "",
|
||||||
|
"postfixFontSize": "50%",
|
||||||
|
"prefix": "",
|
||||||
|
"prefixFontSize": "50%",
|
||||||
|
"rangeMaps": [
|
||||||
|
{
|
||||||
|
"from": "null",
|
||||||
|
"text": "N/A",
|
||||||
|
"to": "null"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"span": 4,
|
||||||
|
"sparkline": {
|
||||||
|
"fillColor": "rgba(31, 118, 189, 0.18)",
|
||||||
|
"full": "true",
|
||||||
|
"lineColor": "rgb(31, 120, 193)",
|
||||||
|
"show": "true"
|
||||||
|
},
|
||||||
|
"tableColumn": "",
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"expr": "round(sum(irate(nginx_ingress_controller_requests{controller_pod=~\"$controller\",controller_class=~\"$controller_class\",namespace=~\"$namespace\"}[2m])), 0.01)",
|
||||||
|
"format": "time_series",
|
||||||
|
"intervalFactor": 2,
|
||||||
|
"legendFormat": "",
|
||||||
|
"refId": "A"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"thresholds": "",
|
||||||
|
"title": "Request Volume",
|
||||||
|
"type": "singlestat",
|
||||||
|
"valueFontSize": "80%",
|
||||||
|
"valueMaps": [
|
||||||
|
{
|
||||||
|
"op": "=",
|
||||||
|
"text": "N/A",
|
||||||
|
"value": "null"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"valueName": "avg"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cacheTimeout": null,
|
||||||
|
"colorBackground": false,
|
||||||
|
"colorValue": false,
|
||||||
|
"colors": [
|
||||||
|
"#299c46",
|
||||||
|
"rgba(237, 129, 40, 0.89)",
|
||||||
|
"#d44a3a"
|
||||||
|
],
|
||||||
|
"datasource": "$datasource",
|
||||||
|
"format": "none",
|
||||||
|
"gauge": {
|
||||||
|
"maxValue": 100,
|
||||||
|
"minValue": 0,
|
||||||
|
"show": false,
|
||||||
|
"thresholdLabels": false,
|
||||||
|
"thresholdMarkers": true
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
|
||||||
|
},
|
||||||
|
"height": "100px",
|
||||||
|
"id": 3,
|
||||||
|
"interval": null,
|
||||||
|
"links": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"mappingType": 1,
|
||||||
|
"mappingTypes": [
|
||||||
|
{
|
||||||
|
"name": "value to text",
|
||||||
|
"value": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "range to text",
|
||||||
|
"value": 2
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"maxDataPoints": 100,
|
||||||
|
"nullPointMode": "connected",
|
||||||
|
"nullText": null,
|
||||||
|
"postfix": "",
|
||||||
|
"postfixFontSize": "50%",
|
||||||
|
"prefix": "",
|
||||||
|
"prefixFontSize": "50%",
|
||||||
|
"rangeMaps": [
|
||||||
|
{
|
||||||
|
"from": "null",
|
||||||
|
"text": "N/A",
|
||||||
|
"to": "null"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"span": 4,
|
||||||
|
"sparkline": {
|
||||||
|
"fillColor": "rgba(31, 118, 189, 0.18)",
|
||||||
|
"full": "true",
|
||||||
|
"lineColor": "rgb(31, 120, 193)",
|
||||||
|
"show": "true"
|
||||||
|
},
|
||||||
|
"tableColumn": "",
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"expr": "sum(avg_over_time(nginx_ingress_controller_nginx_process_connections{controller_pod=~\"$controller\",controller_class=~\"$controller_class\",controller_namespace=~\"$namespace\"}[2m]))",
|
||||||
|
"format": "time_series",
|
||||||
|
"intervalFactor": 2,
|
||||||
|
"legendFormat": "",
|
||||||
|
"refId": "A"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"thresholds": "",
|
||||||
|
"title": "Connections",
|
||||||
|
"type": "singlestat",
|
||||||
|
"valueFontSize": "80%",
|
||||||
|
"valueMaps": [
|
||||||
|
{
|
||||||
|
"op": "=",
|
||||||
|
"text": "N/A",
|
||||||
|
"value": "null"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"valueName": "avg"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cacheTimeout": null,
|
||||||
|
"colorBackground": false,
|
||||||
|
"colorValue": false,
|
||||||
|
"colors": [
|
||||||
|
"#299c46",
|
||||||
|
"rgba(237, 129, 40, 0.89)",
|
||||||
|
"#d44a3a"
|
||||||
|
],
|
||||||
|
"datasource": "$datasource",
|
||||||
|
"format": "percentunit",
|
||||||
|
"gauge": {
|
||||||
|
"maxValue": 100,
|
||||||
|
"minValue": 0,
|
||||||
|
"show": false,
|
||||||
|
"thresholdLabels": false,
|
||||||
|
"thresholdMarkers": true
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
|
||||||
|
},
|
||||||
|
"height": "100px",
|
||||||
|
"id": 4,
|
||||||
|
"interval": null,
|
||||||
|
"links": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"mappingType": 1,
|
||||||
|
"mappingTypes": [
|
||||||
|
{
|
||||||
|
"name": "value to text",
|
||||||
|
"value": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "range to text",
|
||||||
|
"value": 2
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"maxDataPoints": 100,
|
||||||
|
"nullPointMode": "connected",
|
||||||
|
"nullText": null,
|
||||||
|
"postfix": "",
|
||||||
|
"postfixFontSize": "50%",
|
||||||
|
"prefix": "",
|
||||||
|
"prefixFontSize": "50%",
|
||||||
|
"rangeMaps": [
|
||||||
|
{
|
||||||
|
"from": "null",
|
||||||
|
"text": "N/A",
|
||||||
|
"to": "null"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"span": 4,
|
||||||
|
"sparkline": {
|
||||||
|
"fillColor": "rgba(31, 118, 189, 0.18)",
|
||||||
|
"full": "true",
|
||||||
|
"lineColor": "rgb(31, 120, 193)",
|
||||||
|
"show": "true"
|
||||||
|
},
|
||||||
|
"tableColumn": "",
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"expr": "sum(rate(nginx_ingress_controller_requests{controller_pod=~\"$controller\",controller_class=~\"$controller_class\",namespace=~\"$namespace\",status!~\"[4-5].*\"}[2m])) / sum(rate(nginx_ingress_controller_requests{controller_pod=~\"$controller\",controller_class=~\"$controller_class\",namespace=~\"$namespace\"}[2m]))",
|
||||||
|
"format": "time_series",
|
||||||
|
"intervalFactor": 2,
|
||||||
|
"legendFormat": "",
|
||||||
|
"refId": "A"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"thresholds": "",
|
||||||
|
"title": "Success Rate",
|
||||||
|
"type": "singlestat",
|
||||||
|
"valueFontSize": "80%",
|
||||||
|
"valueMaps": [
|
||||||
|
{
|
||||||
|
"op": "=",
|
||||||
|
"text": "N/A",
|
||||||
|
"value": "null"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"valueName": "avg"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"repeat": null,
|
||||||
|
"repeatIteration": null,
|
||||||
|
"repeatRowId": null,
|
||||||
|
"showTitle": false,
|
||||||
|
"title": "Dashboard Row",
|
||||||
|
"titleSize": "h6",
|
||||||
|
"type": "row"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"collapse": false,
|
||||||
|
"collapsed": false,
|
||||||
|
"panels": [
|
||||||
|
{
|
||||||
|
"aliasColors": {
|
||||||
|
|
||||||
|
},
|
||||||
|
"bars": false,
|
||||||
|
"dashLength": 10,
|
||||||
|
"dashes": false,
|
||||||
|
"datasource": "$datasource",
|
||||||
|
"fill": 1,
|
||||||
|
"gridPos": {
|
||||||
|
|
||||||
|
},
|
||||||
|
"id": 5,
|
||||||
|
"legend": {
|
||||||
|
"alignAsTable": "true",
|
||||||
|
"avg": false,
|
||||||
|
"current": "true",
|
||||||
|
"max": false,
|
||||||
|
"min": false,
|
||||||
|
"rightSide": "true",
|
||||||
|
"show": "true",
|
||||||
|
"total": false,
|
||||||
|
"values": "true"
|
||||||
|
},
|
||||||
|
"lines": true,
|
||||||
|
"linewidth": 2,
|
||||||
|
"links": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"nullPointMode": "null",
|
||||||
|
"percentage": false,
|
||||||
|
"pointradius": 5,
|
||||||
|
"points": false,
|
||||||
|
"renderer": "flot",
|
||||||
|
"repeat": null,
|
||||||
|
"seriesOverrides": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"spaceLength": 10,
|
||||||
|
"span": 6,
|
||||||
|
"stack": false,
|
||||||
|
"steppedLine": false,
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"expr": "round(sum(irate(nginx_ingress_controller_requests{controller_pod=~\"$controller\",controller_class=~\"$controller_class\",controller_namespace=~\"$namespace\",ingress=~\"$ingress\"}[2m])) by (ingress), 0.01)",
|
||||||
|
"format": "time_series",
|
||||||
|
"intervalFactor": 2,
|
||||||
|
"legendFormat": "{{ingress}}",
|
||||||
|
"refId": "A"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"thresholds": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"timeFrom": null,
|
||||||
|
"timeShift": null,
|
||||||
|
"title": "Request Rate",
|
||||||
|
"tooltip": {
|
||||||
|
"shared": true,
|
||||||
|
"sort": 0,
|
||||||
|
"value_type": "individual"
|
||||||
|
},
|
||||||
|
"type": "graph",
|
||||||
|
"xaxis": {
|
||||||
|
"buckets": null,
|
||||||
|
"mode": "time",
|
||||||
|
"name": null,
|
||||||
|
"show": true,
|
||||||
|
"values": [
|
||||||
|
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"yaxes": [
|
||||||
|
{
|
||||||
|
"format": "rps",
|
||||||
|
"label": null,
|
||||||
|
"logBase": 2,
|
||||||
|
"max": null,
|
||||||
|
"min": null,
|
||||||
|
"show": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"format": "rps",
|
||||||
|
"label": null,
|
||||||
|
"logBase": 1,
|
||||||
|
"max": null,
|
||||||
|
"min": null,
|
||||||
|
"show": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"aliasColors": {
|
||||||
|
|
||||||
|
},
|
||||||
|
"bars": false,
|
||||||
|
"dashLength": 10,
|
||||||
|
"dashes": false,
|
||||||
|
"datasource": "$datasource",
|
||||||
|
"fill": 1,
|
||||||
|
"gridPos": {
|
||||||
|
|
||||||
|
},
|
||||||
|
"id": 6,
|
||||||
|
"legend": {
|
||||||
|
"alignAsTable": "true",
|
||||||
|
"avg": false,
|
||||||
|
"current": "true",
|
||||||
|
"max": false,
|
||||||
|
"min": false,
|
||||||
|
"rightSide": "true",
|
||||||
|
"show": "true",
|
||||||
|
"total": false,
|
||||||
|
"values": "true"
|
||||||
|
},
|
||||||
|
"lines": true,
|
||||||
|
"linewidth": 2,
|
||||||
|
"links": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"nullPointMode": "null",
|
||||||
|
"percentage": false,
|
||||||
|
"pointradius": 5,
|
||||||
|
"points": false,
|
||||||
|
"renderer": "flot",
|
||||||
|
"repeat": null,
|
||||||
|
"seriesOverrides": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"spaceLength": 10,
|
||||||
|
"span": 6,
|
||||||
|
"stack": false,
|
||||||
|
"steppedLine": false,
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"expr": "sum(rate(nginx_ingress_controller_requests{controller_pod=~\"$controller\",controller_class=~\"$controller_class\",namespace=~\"$namespace\",ingress=~\"$ingress\",status!~\"[4-5].*\"}[2m])) by (ingress) / sum(rate(nginx_ingress_controller_requests{controller_pod=~\"$controller\",controller_class=~\"$controller_class\",namespace=~\"$namespace\",ingress=~\"$ingress\"}[2m])) by (ingress)",
|
||||||
|
"format": "time_series",
|
||||||
|
"intervalFactor": 2,
|
||||||
|
"legendFormat": "{{ingress}}",
|
||||||
|
"refId": "A"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"thresholds": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"timeFrom": null,
|
||||||
|
"timeShift": null,
|
||||||
|
"title": "Success Rate",
|
||||||
|
"tooltip": {
|
||||||
|
"shared": true,
|
||||||
|
"sort": 0,
|
||||||
|
"value_type": "individual"
|
||||||
|
},
|
||||||
|
"type": "graph",
|
||||||
|
"xaxis": {
|
||||||
|
"buckets": null,
|
||||||
|
"mode": "time",
|
||||||
|
"name": null,
|
||||||
|
"show": true,
|
||||||
|
"values": [
|
||||||
|
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"yaxes": [
|
||||||
|
{
|
||||||
|
"format": "percentunit",
|
||||||
|
"label": null,
|
||||||
|
"logBase": 1,
|
||||||
|
"max": 1,
|
||||||
|
"min": null,
|
||||||
|
"show": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"format": "percentunit",
|
||||||
|
"label": null,
|
||||||
|
"logBase": 1,
|
||||||
|
"max": 1,
|
||||||
|
"min": null,
|
||||||
|
"show": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"repeat": null,
|
||||||
|
"repeatIteration": null,
|
||||||
|
"repeatRowId": null,
|
||||||
|
"showTitle": false,
|
||||||
|
"title": "Dashboard Row",
|
||||||
|
"titleSize": "h6",
|
||||||
|
"type": "row"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"collapse": false,
|
||||||
|
"collapsed": false,
|
||||||
|
"panels": [
|
||||||
|
{
|
||||||
|
"aliasColors": {
|
||||||
|
|
||||||
|
},
|
||||||
|
"bars": false,
|
||||||
|
"dashLength": 10,
|
||||||
|
"dashes": false,
|
||||||
|
"datasource": "$datasource",
|
||||||
|
"fill": 1,
|
||||||
|
"gridPos": {
|
||||||
|
|
||||||
|
},
|
||||||
|
"id": 7,
|
||||||
|
"legend": {
|
||||||
|
"alignAsTable": "true",
|
||||||
|
"avg": false,
|
||||||
|
"current": "true",
|
||||||
|
"max": false,
|
||||||
|
"min": false,
|
||||||
|
"rightSide": "true",
|
||||||
|
"show": "true",
|
||||||
|
"total": false,
|
||||||
|
"values": "true"
|
||||||
|
},
|
||||||
|
"lines": true,
|
||||||
|
"linewidth": 2,
|
||||||
|
"links": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"nullPointMode": "null",
|
||||||
|
"percentage": false,
|
||||||
|
"pointradius": 5,
|
||||||
|
"points": false,
|
||||||
|
"renderer": "flot",
|
||||||
|
"repeat": null,
|
||||||
|
"seriesOverrides": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"spaceLength": 10,
|
||||||
|
"span": 12,
|
||||||
|
"stack": false,
|
||||||
|
"steppedLine": false,
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"expr": "histogram_quantile(0.99, sum(rate(nginx_ingress_controller_request_duration_seconds_bucket{ingress!=\"\",controller_pod=~\"$controller\",controller_class=~\"$controller_class\",controller_namespace=~\"$namespace\",ingress=~\"$ingress\"}[2m])) by (le, ingress))",
|
||||||
|
"format": "time_series",
|
||||||
|
"intervalFactor": 2,
|
||||||
|
"legendFormat": "{{ingress}} 99%",
|
||||||
|
"refId": "A"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"expr": "histogram_quantile(0.90, sum(rate(nginx_ingress_controller_request_duration_seconds_bucket{ingress!=\"\",controller_pod=~\"$controller\",controller_class=~\"$controller_class\",controller_namespace=~\"$namespace\",ingress=~\"$ingress\"}[2m])) by (le, ingress))",
|
||||||
|
"format": "time_series",
|
||||||
|
"intervalFactor": 2,
|
||||||
|
"legendFormat": "{{ingress}} 90%",
|
||||||
|
"refId": "B"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"expr": "histogram_quantile(0.50, sum(rate(nginx_ingress_controller_request_duration_seconds_bucket{ingress!=\"\",controller_pod=~\"$controller\",controller_class=~\"$controller_class\",controller_namespace=~\"$namespace\",ingress=~\"$ingress\"}[2m])) by (le, ingress))",
|
||||||
|
"format": "time_series",
|
||||||
|
"intervalFactor": 2,
|
||||||
|
"legendFormat": "{{ingress}} 50%",
|
||||||
|
"refId": "C"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"thresholds": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"timeFrom": null,
|
||||||
|
"timeShift": null,
|
||||||
|
"title": "Latency",
|
||||||
|
"tooltip": {
|
||||||
|
"shared": true,
|
||||||
|
"sort": 0,
|
||||||
|
"value_type": "individual"
|
||||||
|
},
|
||||||
|
"type": "graph",
|
||||||
|
"xaxis": {
|
||||||
|
"buckets": null,
|
||||||
|
"mode": "time",
|
||||||
|
"name": null,
|
||||||
|
"show": true,
|
||||||
|
"values": [
|
||||||
|
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"yaxes": [
|
||||||
|
{
|
||||||
|
"format": "s",
|
||||||
|
"label": null,
|
||||||
|
"logBase": 2,
|
||||||
|
"max": null,
|
||||||
|
"min": null,
|
||||||
|
"show": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"format": "s",
|
||||||
|
"label": null,
|
||||||
|
"logBase": 1,
|
||||||
|
"max": null,
|
||||||
|
"min": null,
|
||||||
|
"show": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"repeat": null,
|
||||||
|
"repeatIteration": null,
|
||||||
|
"repeatRowId": null,
|
||||||
|
"showTitle": false,
|
||||||
|
"title": "Dashboard Row",
|
||||||
|
"titleSize": "h6",
|
||||||
|
"type": "row"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"collapse": false,
|
||||||
|
"collapsed": false,
|
||||||
|
"panels": [
|
||||||
|
{
|
||||||
|
"aliasColors": {
|
||||||
|
|
||||||
|
},
|
||||||
|
"bars": false,
|
||||||
|
"dashLength": 10,
|
||||||
|
"dashes": false,
|
||||||
|
"datasource": "$datasource",
|
||||||
|
"fill": 1,
|
||||||
|
"gridPos": {
|
||||||
|
|
||||||
|
},
|
||||||
|
"id": 8,
|
||||||
|
"legend": {
|
||||||
|
"alignAsTable": "true",
|
||||||
|
"avg": false,
|
||||||
|
"current": "true",
|
||||||
|
"max": false,
|
||||||
|
"min": false,
|
||||||
|
"rightSide": false,
|
||||||
|
"show": "true",
|
||||||
|
"total": false,
|
||||||
|
"values": "true"
|
||||||
|
},
|
||||||
|
"lines": true,
|
||||||
|
"linewidth": 2,
|
||||||
|
"links": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"nullPointMode": "null",
|
||||||
|
"percentage": false,
|
||||||
|
"pointradius": 5,
|
||||||
|
"points": false,
|
||||||
|
"renderer": "flot",
|
||||||
|
"repeat": null,
|
||||||
|
"seriesOverrides": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"spaceLength": 10,
|
||||||
|
"span": 4,
|
||||||
|
"stack": false,
|
||||||
|
"steppedLine": false,
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"expr": "sum (irate (nginx_ingress_controller_request_size_sum{controller_pod=~\"$controller\",controller_class=~\"$controller_class\",controller_namespace=~\"$namespace\"}[2m]))",
|
||||||
|
"format": "time_series",
|
||||||
|
"intervalFactor": 2,
|
||||||
|
"legendFormat": "received",
|
||||||
|
"refId": "A"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"expr": "sum (irate (nginx_ingress_controller_response_size_sum{controller_pod=~\"$controller\",controller_class=~\"$controller_class\",controller_namespace=~\"$namespace\"}[2m]))",
|
||||||
|
"format": "time_series",
|
||||||
|
"intervalFactor": 2,
|
||||||
|
"legendFormat": "sent",
|
||||||
|
"refId": "B"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"thresholds": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"timeFrom": null,
|
||||||
|
"timeShift": null,
|
||||||
|
"title": "Network I/O Pressure",
|
||||||
|
"tooltip": {
|
||||||
|
"shared": true,
|
||||||
|
"sort": 0,
|
||||||
|
"value_type": "individual"
|
||||||
|
},
|
||||||
|
"type": "graph",
|
||||||
|
"xaxis": {
|
||||||
|
"buckets": null,
|
||||||
|
"mode": "time",
|
||||||
|
"name": null,
|
||||||
|
"show": true,
|
||||||
|
"values": [
|
||||||
|
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"yaxes": [
|
||||||
|
{
|
||||||
|
"format": "Bps",
|
||||||
|
"label": null,
|
||||||
|
"logBase": 1,
|
||||||
|
"max": null,
|
||||||
|
"min": null,
|
||||||
|
"show": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"format": "Bps",
|
||||||
|
"label": null,
|
||||||
|
"logBase": 1,
|
||||||
|
"max": null,
|
||||||
|
"min": null,
|
||||||
|
"show": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"aliasColors": {
|
||||||
|
|
||||||
|
},
|
||||||
|
"bars": false,
|
||||||
|
"dashLength": 10,
|
||||||
|
"dashes": false,
|
||||||
|
"datasource": "$datasource",
|
||||||
|
"fill": 1,
|
||||||
|
"gridPos": {
|
||||||
|
|
||||||
|
},
|
||||||
|
"id": 9,
|
||||||
|
"legend": {
|
||||||
|
"alignAsTable": "true",
|
||||||
|
"avg": false,
|
||||||
|
"current": "true",
|
||||||
|
"max": false,
|
||||||
|
"min": false,
|
||||||
|
"rightSide": false,
|
||||||
|
"show": "true",
|
||||||
|
"total": false,
|
||||||
|
"values": "true"
|
||||||
|
},
|
||||||
|
"lines": true,
|
||||||
|
"linewidth": 2,
|
||||||
|
"links": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"nullPointMode": "null",
|
||||||
|
"percentage": false,
|
||||||
|
"pointradius": 5,
|
||||||
|
"points": false,
|
||||||
|
"renderer": "flot",
|
||||||
|
"repeat": null,
|
||||||
|
"seriesOverrides": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"spaceLength": 10,
|
||||||
|
"span": 4,
|
||||||
|
"stack": false,
|
||||||
|
"steppedLine": false,
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"expr": "avg(nginx_ingress_controller_nginx_process_resident_memory_bytes{controller_pod=~\"$controller\",controller_class=~\"$controller_class\",controller_namespace=~\"$namespace\"}) by (controller_pod)",
|
||||||
|
"format": "time_series",
|
||||||
|
"intervalFactor": 2,
|
||||||
|
"legendFormat": "{{controller_pod}}",
|
||||||
|
"refId": "A"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"thresholds": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"timeFrom": null,
|
||||||
|
"timeShift": null,
|
||||||
|
"title": "Avg Memory Usage",
|
||||||
|
"tooltip": {
|
||||||
|
"shared": true,
|
||||||
|
"sort": 0,
|
||||||
|
"value_type": "individual"
|
||||||
|
},
|
||||||
|
"type": "graph",
|
||||||
|
"xaxis": {
|
||||||
|
"buckets": null,
|
||||||
|
"mode": "time",
|
||||||
|
"name": null,
|
||||||
|
"show": true,
|
||||||
|
"values": [
|
||||||
|
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"yaxes": [
|
||||||
|
{
|
||||||
|
"format": "bytes",
|
||||||
|
"label": null,
|
||||||
|
"logBase": 1,
|
||||||
|
"max": null,
|
||||||
|
"min": null,
|
||||||
|
"show": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"format": "bytes",
|
||||||
|
"label": null,
|
||||||
|
"logBase": 1,
|
||||||
|
"max": null,
|
||||||
|
"min": null,
|
||||||
|
"show": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"aliasColors": {
|
||||||
|
|
||||||
|
},
|
||||||
|
"bars": false,
|
||||||
|
"dashLength": 10,
|
||||||
|
"dashes": false,
|
||||||
|
"datasource": "$datasource",
|
||||||
|
"fill": 1,
|
||||||
|
"gridPos": {
|
||||||
|
|
||||||
|
},
|
||||||
|
"id": 10,
|
||||||
|
"legend": {
|
||||||
|
"alignAsTable": "true",
|
||||||
|
"avg": false,
|
||||||
|
"current": "true",
|
||||||
|
"max": false,
|
||||||
|
"min": false,
|
||||||
|
"rightSide": false,
|
||||||
|
"show": "true",
|
||||||
|
"total": false,
|
||||||
|
"values": "true"
|
||||||
|
},
|
||||||
|
"lines": true,
|
||||||
|
"linewidth": 2,
|
||||||
|
"links": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"nullPointMode": "null",
|
||||||
|
"percentage": false,
|
||||||
|
"pointradius": 5,
|
||||||
|
"points": false,
|
||||||
|
"renderer": "flot",
|
||||||
|
"repeat": null,
|
||||||
|
"seriesOverrides": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"spaceLength": 10,
|
||||||
|
"span": 4,
|
||||||
|
"stack": false,
|
||||||
|
"steppedLine": false,
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"expr": "sum(rate(nginx_ingress_controller_nginx_process_cpu_seconds_total{controller_pod=~\"$controller\",controller_class=~\"$controller_class\",controller_namespace=~\"$namespace\"}[2m])) by (controller_pod)",
|
||||||
|
"format": "time_series",
|
||||||
|
"intervalFactor": 2,
|
||||||
|
"legendFormat": "{{controller_pod}}",
|
||||||
|
"refId": "A"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"thresholds": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"timeFrom": null,
|
||||||
|
"timeShift": null,
|
||||||
|
"title": "Avg CPU Usage",
|
||||||
|
"tooltip": {
|
||||||
|
"shared": true,
|
||||||
|
"sort": 0,
|
||||||
|
"value_type": "individual"
|
||||||
|
},
|
||||||
|
"type": "graph",
|
||||||
|
"xaxis": {
|
||||||
|
"buckets": null,
|
||||||
|
"mode": "time",
|
||||||
|
"name": null,
|
||||||
|
"show": true,
|
||||||
|
"values": [
|
||||||
|
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"yaxes": [
|
||||||
|
{
|
||||||
|
"format": "none",
|
||||||
|
"label": null,
|
||||||
|
"logBase": 1,
|
||||||
|
"max": null,
|
||||||
|
"min": null,
|
||||||
|
"show": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"format": "none",
|
||||||
|
"label": null,
|
||||||
|
"logBase": 1,
|
||||||
|
"max": null,
|
||||||
|
"min": null,
|
||||||
|
"show": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"repeat": null,
|
||||||
|
"repeatIteration": null,
|
||||||
|
"repeatRowId": null,
|
||||||
|
"showTitle": false,
|
||||||
|
"title": "Dashboard Row",
|
||||||
|
"titleSize": "h6",
|
||||||
|
"type": "row"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"schemaVersion": 14,
|
||||||
|
"style": "dark",
|
||||||
|
"tags": [
|
||||||
|
"nginx-ingress"
|
||||||
|
],
|
||||||
|
"templating": {
|
||||||
|
"list": [
|
||||||
|
{
|
||||||
|
"current": {
|
||||||
|
"text": "Prometheus",
|
||||||
|
"value": "Prometheus"
|
||||||
|
},
|
||||||
|
"hide": 0,
|
||||||
|
"label": null,
|
||||||
|
"name": "datasource",
|
||||||
|
"options": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"query": "prometheus",
|
||||||
|
"refresh": 1,
|
||||||
|
"regex": "",
|
||||||
|
"type": "datasource"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"allValue": ".*",
|
||||||
|
"current": {
|
||||||
|
|
||||||
|
},
|
||||||
|
"datasource": "$datasource",
|
||||||
|
"hide": 0,
|
||||||
|
"includeAll": true,
|
||||||
|
"label": null,
|
||||||
|
"multi": false,
|
||||||
|
"name": "namespace",
|
||||||
|
"options": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"query": "label_values(nginx_ingress_controller_config_hash, controller_namespace)",
|
||||||
|
"refresh": 2,
|
||||||
|
"regex": "",
|
||||||
|
"sort": 0,
|
||||||
|
"tagValuesQuery": "",
|
||||||
|
"tags": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"tagsQuery": "",
|
||||||
|
"type": "query",
|
||||||
|
"useTags": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"allValue": ".*",
|
||||||
|
"current": {
|
||||||
|
|
||||||
|
},
|
||||||
|
"datasource": "$datasource",
|
||||||
|
"hide": 0,
|
||||||
|
"includeAll": true,
|
||||||
|
"label": null,
|
||||||
|
"multi": false,
|
||||||
|
"name": "controller_class",
|
||||||
|
"options": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"query": "label_values(nginx_ingress_controller_config_hash{namespace=~\"$namespace\"}, controller_class)",
|
||||||
|
"refresh": 2,
|
||||||
|
"regex": "",
|
||||||
|
"sort": 0,
|
||||||
|
"tagValuesQuery": "",
|
||||||
|
"tags": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"tagsQuery": "",
|
||||||
|
"type": "query",
|
||||||
|
"useTags": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"allValue": ".*",
|
||||||
|
"current": {
|
||||||
|
|
||||||
|
},
|
||||||
|
"datasource": "$datasource",
|
||||||
|
"hide": 0,
|
||||||
|
"includeAll": true,
|
||||||
|
"label": null,
|
||||||
|
"multi": false,
|
||||||
|
"name": "controller",
|
||||||
|
"options": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"query": "label_values(nginx_ingress_controller_config_hash{namespace=~\"$namespace\",controller_class=~\"$controller_class\"}, controller_pod)",
|
||||||
|
"refresh": 2,
|
||||||
|
"regex": "",
|
||||||
|
"sort": 0,
|
||||||
|
"tagValuesQuery": "",
|
||||||
|
"tags": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"tagsQuery": "",
|
||||||
|
"type": "query",
|
||||||
|
"useTags": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"allValue": ".*",
|
||||||
|
"current": {
|
||||||
|
|
||||||
|
},
|
||||||
|
"datasource": "$datasource",
|
||||||
|
"hide": 0,
|
||||||
|
"includeAll": true,
|
||||||
|
"label": null,
|
||||||
|
"multi": false,
|
||||||
|
"name": "ingress",
|
||||||
|
"options": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"query": "label_values(nginx_ingress_controller_requests{namespace=~\"$namespace\",controller_class=~\"$controller_class\",controller=~\"$controller\"}, ingress)",
|
||||||
|
"refresh": 2,
|
||||||
|
"regex": "",
|
||||||
|
"sort": 0,
|
||||||
|
"tagValuesQuery": "",
|
||||||
|
"tags": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"tagsQuery": "",
|
||||||
|
"type": "query",
|
||||||
|
"useTags": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"time": {
|
||||||
|
"from": "now-1h",
|
||||||
|
"to": "now"
|
||||||
|
},
|
||||||
|
"timepicker": {
|
||||||
|
"refresh_intervals": [
|
||||||
|
"5s",
|
||||||
|
"10s",
|
||||||
|
"30s",
|
||||||
|
"1m",
|
||||||
|
"5m",
|
||||||
|
"15m",
|
||||||
|
"30m",
|
||||||
|
"1h",
|
||||||
|
"2h",
|
||||||
|
"1d"
|
||||||
|
],
|
||||||
|
"time_options": [
|
||||||
|
"5m",
|
||||||
|
"15m",
|
||||||
|
"1h",
|
||||||
|
"6h",
|
||||||
|
"12h",
|
||||||
|
"24h",
|
||||||
|
"2d",
|
||||||
|
"7d",
|
||||||
|
"30d"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"timezone": "",
|
||||||
|
"title": "Nginx Ingress Controller",
|
||||||
|
"uid": "f4af03eca476c08ecf2b5cf15fd60168",
|
||||||
|
"version": 0
|
||||||
|
}
|
@ -23,7 +23,7 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: grafana
|
- name: grafana
|
||||||
image: docker.io/grafana/grafana:6.2.5
|
image: docker.io/grafana/grafana:6.4.1
|
||||||
env:
|
env:
|
||||||
- name: GF_PATHS_CONFIG
|
- name: GF_PATHS_CONFIG
|
||||||
value: "/etc/grafana/custom.ini"
|
value: "/etc/grafana/custom.ini"
|
||||||
@ -64,6 +64,10 @@ spec:
|
|||||||
mountPath: /etc/grafana/dashboards/k8s-nodes
|
mountPath: /etc/grafana/dashboards/k8s-nodes
|
||||||
- name: dashboards-k8s-resources
|
- name: dashboards-k8s-resources
|
||||||
mountPath: /etc/grafana/dashboards/k8s-resources
|
mountPath: /etc/grafana/dashboards/k8s-resources
|
||||||
|
- name: dashboards-coredns
|
||||||
|
mountPath: /etc/grafana/dashboards/coredns
|
||||||
|
- name: dashboards-nginx-ingress
|
||||||
|
mountPath: /etc/grafana/dashboards/nginx-ingress
|
||||||
volumes:
|
volumes:
|
||||||
- name: config
|
- name: config
|
||||||
configMap:
|
configMap:
|
||||||
@ -89,4 +93,10 @@ spec:
|
|||||||
- name: dashboards-k8s-resources
|
- name: dashboards-k8s-resources
|
||||||
configMap:
|
configMap:
|
||||||
name: grafana-dashboards-k8s-resources
|
name: grafana-dashboards-k8s-resources
|
||||||
|
- name: dashboards-coredns
|
||||||
|
configMap:
|
||||||
|
name: grafana-dashboards-coredns
|
||||||
|
- name: dashboards-nginx-ingress
|
||||||
|
configMap:
|
||||||
|
name: grafana-dashboards-nginx-ingress
|
||||||
|
|
||||||
|
@ -20,11 +20,9 @@ spec:
|
|||||||
annotations:
|
annotations:
|
||||||
seccomp.security.alpha.kubernetes.io/pod: 'docker/default'
|
seccomp.security.alpha.kubernetes.io/pod: 'docker/default'
|
||||||
spec:
|
spec:
|
||||||
nodeSelector:
|
|
||||||
node-role.kubernetes.io/node: ""
|
|
||||||
containers:
|
containers:
|
||||||
- name: nginx-ingress-controller
|
- name: nginx-ingress-controller
|
||||||
image: quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.25.0
|
image: quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.26.1
|
||||||
args:
|
args:
|
||||||
- /nginx-ingress-controller
|
- /nginx-ingress-controller
|
||||||
- --ingress-class=public
|
- --ingress-class=public
|
||||||
@ -67,6 +65,11 @@ spec:
|
|||||||
periodSeconds: 10
|
periodSeconds: 10
|
||||||
successThreshold: 1
|
successThreshold: 1
|
||||||
timeoutSeconds: 5
|
timeoutSeconds: 5
|
||||||
|
lifecycle:
|
||||||
|
preStop:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /wait-shutdown
|
||||||
securityContext:
|
securityContext:
|
||||||
capabilities:
|
capabilities:
|
||||||
add:
|
add:
|
||||||
@ -75,4 +78,4 @@ spec:
|
|||||||
- ALL
|
- ALL
|
||||||
runAsUser: 33 # www-data
|
runAsUser: 33 # www-data
|
||||||
restartPolicy: Always
|
restartPolicy: Always
|
||||||
terminationGracePeriodSeconds: 60
|
terminationGracePeriodSeconds: 300
|
||||||
|
@ -20,11 +20,9 @@ spec:
|
|||||||
annotations:
|
annotations:
|
||||||
seccomp.security.alpha.kubernetes.io/pod: 'docker/default'
|
seccomp.security.alpha.kubernetes.io/pod: 'docker/default'
|
||||||
spec:
|
spec:
|
||||||
nodeSelector:
|
|
||||||
node-role.kubernetes.io/node: ""
|
|
||||||
containers:
|
containers:
|
||||||
- name: nginx-ingress-controller
|
- name: nginx-ingress-controller
|
||||||
image: quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.25.0
|
image: quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.26.1
|
||||||
args:
|
args:
|
||||||
- /nginx-ingress-controller
|
- /nginx-ingress-controller
|
||||||
- --ingress-class=public
|
- --ingress-class=public
|
||||||
@ -67,6 +65,11 @@ spec:
|
|||||||
periodSeconds: 10
|
periodSeconds: 10
|
||||||
successThreshold: 1
|
successThreshold: 1
|
||||||
timeoutSeconds: 5
|
timeoutSeconds: 5
|
||||||
|
lifecycle:
|
||||||
|
preStop:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /wait-shutdown
|
||||||
securityContext:
|
securityContext:
|
||||||
capabilities:
|
capabilities:
|
||||||
add:
|
add:
|
||||||
@ -75,4 +78,4 @@ spec:
|
|||||||
- ALL
|
- ALL
|
||||||
runAsUser: 33 # www-data
|
runAsUser: 33 # www-data
|
||||||
restartPolicy: Always
|
restartPolicy: Always
|
||||||
terminationGracePeriodSeconds: 60
|
terminationGracePeriodSeconds: 300
|
||||||
|
@ -22,7 +22,7 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: nginx-ingress-controller
|
- name: nginx-ingress-controller
|
||||||
image: quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.25.0
|
image: quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.26.1
|
||||||
args:
|
args:
|
||||||
- /nginx-ingress-controller
|
- /nginx-ingress-controller
|
||||||
- --ingress-class=public
|
- --ingress-class=public
|
||||||
@ -62,6 +62,11 @@ spec:
|
|||||||
successThreshold: 1
|
successThreshold: 1
|
||||||
failureThreshold: 3
|
failureThreshold: 3
|
||||||
timeoutSeconds: 5
|
timeoutSeconds: 5
|
||||||
|
lifecycle:
|
||||||
|
preStop:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /wait-shutdown
|
||||||
securityContext:
|
securityContext:
|
||||||
capabilities:
|
capabilities:
|
||||||
add:
|
add:
|
||||||
@ -70,5 +75,5 @@ spec:
|
|||||||
- ALL
|
- ALL
|
||||||
runAsUser: 33 # www-data
|
runAsUser: 33 # www-data
|
||||||
restartPolicy: Always
|
restartPolicy: Always
|
||||||
terminationGracePeriodSeconds: 60
|
terminationGracePeriodSeconds: 300
|
||||||
|
|
||||||
|
@ -20,11 +20,9 @@ spec:
|
|||||||
annotations:
|
annotations:
|
||||||
seccomp.security.alpha.kubernetes.io/pod: 'docker/default'
|
seccomp.security.alpha.kubernetes.io/pod: 'docker/default'
|
||||||
spec:
|
spec:
|
||||||
nodeSelector:
|
|
||||||
node-role.kubernetes.io/node: ""
|
|
||||||
containers:
|
containers:
|
||||||
- name: nginx-ingress-controller
|
- name: nginx-ingress-controller
|
||||||
image: quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.25.0
|
image: quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.26.1
|
||||||
args:
|
args:
|
||||||
- /nginx-ingress-controller
|
- /nginx-ingress-controller
|
||||||
- --ingress-class=public
|
- --ingress-class=public
|
||||||
@ -67,6 +65,11 @@ spec:
|
|||||||
periodSeconds: 10
|
periodSeconds: 10
|
||||||
successThreshold: 1
|
successThreshold: 1
|
||||||
timeoutSeconds: 5
|
timeoutSeconds: 5
|
||||||
|
lifecycle:
|
||||||
|
preStop:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /wait-shutdown
|
||||||
securityContext:
|
securityContext:
|
||||||
capabilities:
|
capabilities:
|
||||||
add:
|
add:
|
||||||
@ -75,4 +78,4 @@ spec:
|
|||||||
- ALL
|
- ALL
|
||||||
runAsUser: 33 # www-data
|
runAsUser: 33 # www-data
|
||||||
restartPolicy: Always
|
restartPolicy: Always
|
||||||
terminationGracePeriodSeconds: 60
|
terminationGracePeriodSeconds: 300
|
||||||
|
@ -20,11 +20,9 @@ spec:
|
|||||||
annotations:
|
annotations:
|
||||||
seccomp.security.alpha.kubernetes.io/pod: 'docker/default'
|
seccomp.security.alpha.kubernetes.io/pod: 'docker/default'
|
||||||
spec:
|
spec:
|
||||||
nodeSelector:
|
|
||||||
node-role.kubernetes.io/node: ""
|
|
||||||
containers:
|
containers:
|
||||||
- name: nginx-ingress-controller
|
- name: nginx-ingress-controller
|
||||||
image: quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.25.0
|
image: quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.26.1
|
||||||
args:
|
args:
|
||||||
- /nginx-ingress-controller
|
- /nginx-ingress-controller
|
||||||
- --ingress-class=public
|
- --ingress-class=public
|
||||||
@ -67,6 +65,11 @@ spec:
|
|||||||
periodSeconds: 10
|
periodSeconds: 10
|
||||||
successThreshold: 1
|
successThreshold: 1
|
||||||
timeoutSeconds: 5
|
timeoutSeconds: 5
|
||||||
|
lifecycle:
|
||||||
|
preStop:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /wait-shutdown
|
||||||
securityContext:
|
securityContext:
|
||||||
capabilities:
|
capabilities:
|
||||||
add:
|
add:
|
||||||
@ -75,4 +78,4 @@ spec:
|
|||||||
- ALL
|
- ALL
|
||||||
runAsUser: 33 # www-data
|
runAsUser: 33 # www-data
|
||||||
restartPolicy: Always
|
restartPolicy: Always
|
||||||
terminationGracePeriodSeconds: 60
|
terminationGracePeriodSeconds: 300
|
||||||
|
@ -115,7 +115,7 @@ data:
|
|||||||
- role: node
|
- role: node
|
||||||
scheme: http
|
scheme: http
|
||||||
relabel_configs:
|
relabel_configs:
|
||||||
- source_labels: [__meta_kubernetes_node_label_node_role_kubernetes_io_controller]
|
- source_labels: [__meta_kubernetes_node_label_node_kubernetes_io_controller]
|
||||||
action: keep
|
action: keep
|
||||||
regex: 'true'
|
regex: 'true'
|
||||||
- action: labelmap
|
- action: labelmap
|
||||||
|
@ -20,7 +20,7 @@ spec:
|
|||||||
serviceAccountName: prometheus
|
serviceAccountName: prometheus
|
||||||
containers:
|
containers:
|
||||||
- name: prometheus
|
- name: prometheus
|
||||||
image: quay.io/prometheus/prometheus:v2.11.0
|
image: quay.io/prometheus/prometheus:v2.13.0
|
||||||
args:
|
args:
|
||||||
- --web.listen-address=0.0.0.0:9090
|
- --web.listen-address=0.0.0.0:9090
|
||||||
- --config.file=/etc/prometheus/prometheus.yaml
|
- --config.file=/etc/prometheus/prometheus.yaml
|
||||||
|
@ -24,16 +24,22 @@ spec:
|
|||||||
serviceAccountName: kube-state-metrics
|
serviceAccountName: kube-state-metrics
|
||||||
containers:
|
containers:
|
||||||
- name: kube-state-metrics
|
- name: kube-state-metrics
|
||||||
image: quay.io/coreos/kube-state-metrics:v1.7.1
|
image: quay.io/coreos/kube-state-metrics:v1.8.0
|
||||||
ports:
|
ports:
|
||||||
- name: metrics
|
- name: metrics
|
||||||
containerPort: 8080
|
containerPort: 8080
|
||||||
readinessProbe:
|
livenessProbe:
|
||||||
httpGet:
|
httpGet:
|
||||||
path: /healthz
|
path: /healthz
|
||||||
port: 8080
|
port: 8080
|
||||||
initialDelaySeconds: 5
|
initialDelaySeconds: 5
|
||||||
timeoutSeconds: 5
|
timeoutSeconds: 5
|
||||||
|
readinessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /
|
||||||
|
port: 8080
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
timeoutSeconds: 5
|
||||||
- name: addon-resizer
|
- name: addon-resizer
|
||||||
image: k8s.gcr.io/addon-resizer:1.8.5
|
image: k8s.gcr.io/addon-resizer:1.8.5
|
||||||
resources:
|
resources:
|
||||||
|
@ -11,7 +11,7 @@ Typhoon distributes upstream Kubernetes, architectural conventions, and cluster
|
|||||||
|
|
||||||
## Features <a href="https://www.cncf.io/certification/software-conformance/"><img align="right" src="https://storage.googleapis.com/poseidon/certified-kubernetes.png"></a>
|
## Features <a href="https://www.cncf.io/certification/software-conformance/"><img align="right" src="https://storage.googleapis.com/poseidon/certified-kubernetes.png"></a>
|
||||||
|
|
||||||
* Kubernetes v1.15.1 (upstream, via [kubernetes-incubator/bootkube](https://github.com/kubernetes-incubator/bootkube))
|
* Kubernetes v1.16.1 (upstream)
|
||||||
* Single or multi-master, [Calico](https://www.projectcalico.org/) or [flannel](https://github.com/coreos/flannel) networking
|
* Single or multi-master, [Calico](https://www.projectcalico.org/) or [flannel](https://github.com/coreos/flannel) networking
|
||||||
* On-cluster etcd with TLS, [RBAC](https://kubernetes.io/docs/admin/authorization/rbac/)-enabled, [network policy](https://kubernetes.io/docs/concepts/services-networking/network-policies/)
|
* On-cluster etcd with TLS, [RBAC](https://kubernetes.io/docs/admin/authorization/rbac/)-enabled, [network policy](https://kubernetes.io/docs/concepts/services-networking/network-policies/)
|
||||||
* Advanced features like [worker pools](https://typhoon.psdn.io/advanced/worker-pools/), [spot](https://typhoon.psdn.io/cl/aws/#spot) workers, and [snippets](https://typhoon.psdn.io/advanced/customization/#container-linux) customization
|
* Advanced features like [worker pools](https://typhoon.psdn.io/advanced/worker-pools/), [spot](https://typhoon.psdn.io/cl/aws/#spot) workers, and [snippets](https://typhoon.psdn.io/advanced/customization/#container-linux) customization
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Self-hosted Kubernetes assets (kubeconfig, manifests)
|
# Kubernetes assets (kubeconfig, manifests)
|
||||||
module "bootkube" {
|
module "bootstrap" {
|
||||||
source = "git::https://github.com/poseidon/terraform-render-bootkube.git?ref=5b9faa903182505ac534f42a2cf250d5d215941b"
|
source = "git::https://github.com/poseidon/terraform-render-bootstrap.git?ref=586d6e36f67c56fb2283f317a7552638368c5779"
|
||||||
|
|
||||||
cluster_name = var.cluster_name
|
cluster_name = var.cluster_name
|
||||||
api_servers = [format("%s.%s", var.cluster_name, var.dns_zone)]
|
api_servers = [format("%s.%s", var.cluster_name, var.dns_zone)]
|
@ -7,7 +7,7 @@ systemd:
|
|||||||
- name: 40-etcd-cluster.conf
|
- name: 40-etcd-cluster.conf
|
||||||
contents: |
|
contents: |
|
||||||
[Service]
|
[Service]
|
||||||
Environment="ETCD_IMAGE_TAG=v3.3.13"
|
Environment="ETCD_IMAGE_TAG=v3.4.1"
|
||||||
Environment="ETCD_NAME=${etcd_name}"
|
Environment="ETCD_NAME=${etcd_name}"
|
||||||
Environment="ETCD_ADVERTISE_CLIENT_URLS=https://${etcd_domain}:2379"
|
Environment="ETCD_ADVERTISE_CLIENT_URLS=https://${etcd_domain}:2379"
|
||||||
Environment="ETCD_INITIAL_ADVERTISE_PEER_URLS=https://${etcd_domain}:2380"
|
Environment="ETCD_INITIAL_ADVERTISE_PEER_URLS=https://${etcd_domain}:2380"
|
||||||
@ -64,11 +64,9 @@ systemd:
|
|||||||
--mount volume=var-log,target=/var/log \
|
--mount volume=var-log,target=/var/log \
|
||||||
--insecure-options=image"
|
--insecure-options=image"
|
||||||
Environment=KUBELET_CGROUP_DRIVER=${cgroup_driver}
|
Environment=KUBELET_CGROUP_DRIVER=${cgroup_driver}
|
||||||
ExecStartPre=/bin/mkdir -p /opt/cni/bin
|
|
||||||
ExecStartPre=/bin/mkdir -p /etc/kubernetes/manifests
|
|
||||||
ExecStartPre=/bin/mkdir -p /etc/kubernetes/cni/net.d
|
ExecStartPre=/bin/mkdir -p /etc/kubernetes/cni/net.d
|
||||||
ExecStartPre=/bin/mkdir -p /etc/kubernetes/checkpoint-secrets
|
ExecStartPre=/bin/mkdir -p /etc/kubernetes/manifests
|
||||||
ExecStartPre=/bin/mkdir -p /etc/kubernetes/inactive-manifests
|
ExecStartPre=/bin/mkdir -p /opt/cni/bin
|
||||||
ExecStartPre=/bin/mkdir -p /var/lib/cni
|
ExecStartPre=/bin/mkdir -p /var/lib/cni
|
||||||
ExecStartPre=/bin/mkdir -p /var/lib/calico
|
ExecStartPre=/bin/mkdir -p /var/lib/calico
|
||||||
ExecStartPre=/bin/mkdir -p /var/lib/kubelet/volumeplugins
|
ExecStartPre=/bin/mkdir -p /var/lib/kubelet/volumeplugins
|
||||||
@ -87,8 +85,8 @@ systemd:
|
|||||||
--kubeconfig=/etc/kubernetes/kubeconfig \
|
--kubeconfig=/etc/kubernetes/kubeconfig \
|
||||||
--lock-file=/var/run/lock/kubelet.lock \
|
--lock-file=/var/run/lock/kubelet.lock \
|
||||||
--network-plugin=cni \
|
--network-plugin=cni \
|
||||||
--node-labels=node-role.kubernetes.io/master \
|
--node-labels=node.kubernetes.io/master \
|
||||||
--node-labels=node-role.kubernetes.io/controller="true" \
|
--node-labels=node.kubernetes.io/controller="true" \
|
||||||
--pod-manifest-path=/etc/kubernetes/manifests \
|
--pod-manifest-path=/etc/kubernetes/manifests \
|
||||||
--read-only-port=0 \
|
--read-only-port=0 \
|
||||||
--register-with-taints=node-role.kubernetes.io/master=:NoSchedule \
|
--register-with-taints=node-role.kubernetes.io/master=:NoSchedule \
|
||||||
@ -98,17 +96,28 @@ systemd:
|
|||||||
RestartSec=10
|
RestartSec=10
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
- name: bootkube.service
|
- name: bootstrap.service
|
||||||
contents: |
|
contents: |
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Bootstrap a Kubernetes cluster
|
Description=Kubernetes control plane
|
||||||
ConditionPathExists=!/opt/bootkube/init_bootkube.done
|
ConditionPathExists=!/opt/bootstrap/bootstrap.done
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
RemainAfterExit=true
|
RemainAfterExit=true
|
||||||
WorkingDirectory=/opt/bootkube
|
WorkingDirectory=/opt/bootstrap
|
||||||
ExecStart=/opt/bootkube/bootkube-start
|
ExecStartPre=-/usr/bin/bash -c 'set -x && [ -n "$(ls /opt/bootstrap/assets/manifests-*/* 2>/dev/null)" ] && mv /opt/bootstrap/assets/manifests-*/* /opt/bootstrap/assets/manifests && rm -rf /opt/bootstrap/assets/manifests-*'
|
||||||
ExecStartPost=/bin/touch /opt/bootkube/init_bootkube.done
|
ExecStart=/usr/bin/rkt run \
|
||||||
|
--trust-keys-from-https \
|
||||||
|
--volume assets,kind=host,source=/opt/bootstrap/assets \
|
||||||
|
--mount volume=assets,target=/assets \
|
||||||
|
--volume script,kind=host,source=/opt/bootstrap/apply \
|
||||||
|
--mount volume=script,target=/apply \
|
||||||
|
--insecure-options=image \
|
||||||
|
docker://k8s.gcr.io/hyperkube:v1.16.1 \
|
||||||
|
--net=host \
|
||||||
|
--dns=host \
|
||||||
|
--exec=/apply
|
||||||
|
ExecStartPost=/bin/touch /opt/bootstrap/bootstrap.done
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
storage:
|
storage:
|
||||||
@ -125,37 +134,27 @@ storage:
|
|||||||
contents:
|
contents:
|
||||||
inline: |
|
inline: |
|
||||||
KUBELET_IMAGE_URL=docker://k8s.gcr.io/hyperkube
|
KUBELET_IMAGE_URL=docker://k8s.gcr.io/hyperkube
|
||||||
KUBELET_IMAGE_TAG=v1.15.1
|
KUBELET_IMAGE_TAG=v1.16.1
|
||||||
|
- path: /opt/bootstrap/apply
|
||||||
|
filesystem: root
|
||||||
|
mode: 0544
|
||||||
|
contents:
|
||||||
|
inline: |
|
||||||
|
#!/bin/bash -e
|
||||||
|
export KUBECONFIG=/assets/auth/kubeconfig
|
||||||
|
until kubectl version; do
|
||||||
|
echo "Waiting for static pod control plane"
|
||||||
|
sleep 5
|
||||||
|
done
|
||||||
|
until kubectl apply -f /assets/manifests -R; do
|
||||||
|
echo "Retry applying manifests"
|
||||||
|
sleep 5
|
||||||
|
done
|
||||||
- path: /etc/sysctl.d/max-user-watches.conf
|
- path: /etc/sysctl.d/max-user-watches.conf
|
||||||
filesystem: root
|
filesystem: root
|
||||||
contents:
|
contents:
|
||||||
inline: |
|
inline: |
|
||||||
fs.inotify.max_user_watches=16184
|
fs.inotify.max_user_watches=16184
|
||||||
- path: /opt/bootkube/bootkube-start
|
|
||||||
filesystem: root
|
|
||||||
mode: 0544
|
|
||||||
user:
|
|
||||||
id: 500
|
|
||||||
group:
|
|
||||||
id: 500
|
|
||||||
contents:
|
|
||||||
inline: |
|
|
||||||
#!/bin/bash
|
|
||||||
# Wrapper for bootkube start
|
|
||||||
set -e
|
|
||||||
# Move experimental manifests
|
|
||||||
[ -n "$(ls /opt/bootkube/assets/manifests-*/* 2>/dev/null)" ] && mv /opt/bootkube/assets/manifests-*/* /opt/bootkube/assets/manifests && rm -rf /opt/bootkube/assets/manifests-*
|
|
||||||
exec /usr/bin/rkt run \
|
|
||||||
--trust-keys-from-https \
|
|
||||||
--volume assets,kind=host,source=/opt/bootkube/assets \
|
|
||||||
--mount volume=assets,target=/assets \
|
|
||||||
--volume bootstrap,kind=host,source=/etc/kubernetes \
|
|
||||||
--mount volume=bootstrap,target=/etc/kubernetes \
|
|
||||||
$${RKT_OPTS} \
|
|
||||||
quay.io/coreos/bootkube:v0.14.0 \
|
|
||||||
--net=host \
|
|
||||||
--dns=host \
|
|
||||||
--exec=/bootkube -- start --asset-dir=/assets "$@"
|
|
||||||
passwd:
|
passwd:
|
||||||
users:
|
users:
|
||||||
- name: core
|
- name: core
|
||||||
|
@ -31,6 +31,7 @@ resource "aws_instance" "controllers" {
|
|||||||
volume_type = var.disk_type
|
volume_type = var.disk_type
|
||||||
volume_size = var.disk_size
|
volume_size = var.disk_size
|
||||||
iops = var.disk_iops
|
iops = var.disk_iops
|
||||||
|
encrypted = true
|
||||||
}
|
}
|
||||||
|
|
||||||
# network
|
# network
|
||||||
@ -70,7 +71,7 @@ data "template_file" "controller-configs" {
|
|||||||
# etcd0=https://cluster-etcd0.example.com,etcd1=https://cluster-etcd1.example.com,...
|
# etcd0=https://cluster-etcd0.example.com,etcd1=https://cluster-etcd1.example.com,...
|
||||||
etcd_initial_cluster = join(",", data.template_file.etcds.*.rendered)
|
etcd_initial_cluster = join(",", data.template_file.etcds.*.rendered)
|
||||||
cgroup_driver = local.flavor == "flatcar" && local.channel == "edge" ? "systemd" : "cgroupfs"
|
cgroup_driver = local.flavor == "flatcar" && local.channel == "edge" ? "systemd" : "cgroupfs"
|
||||||
kubeconfig = indent(10, module.bootkube.kubeconfig-kubelet)
|
kubeconfig = indent(10, module.bootstrap.kubeconfig-kubelet)
|
||||||
ssh_authorized_key = var.ssh_authorized_key
|
ssh_authorized_key = var.ssh_authorized_key
|
||||||
cluster_dns_service_ip = cidrhost(var.service_cidr, 10)
|
cluster_dns_service_ip = cidrhost(var.service_cidr, 10)
|
||||||
cluster_domain_suffix = var.cluster_domain_suffix
|
cluster_domain_suffix = var.cluster_domain_suffix
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
output "kubeconfig-admin" {
|
output "kubeconfig-admin" {
|
||||||
value = module.bootkube.kubeconfig-admin
|
value = module.bootstrap.kubeconfig-admin
|
||||||
}
|
}
|
||||||
|
|
||||||
# Outputs for Kubernetes Ingress
|
# Outputs for Kubernetes Ingress
|
||||||
@ -32,7 +32,7 @@ output "worker_security_groups" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
output "kubeconfig" {
|
output "kubeconfig" {
|
||||||
value = module.bootkube.kubeconfig-kubelet
|
value = module.bootstrap.kubeconfig-kubelet
|
||||||
}
|
}
|
||||||
|
|
||||||
# Outputs for custom load balancing
|
# Outputs for custom load balancing
|
||||||
|
@ -33,6 +33,28 @@ resource "aws_security_group_rule" "controller-etcd" {
|
|||||||
self = true
|
self = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Allow Prometheus to scrape kube-scheduler
|
||||||
|
resource "aws_security_group_rule" "controller-scheduler-metrics" {
|
||||||
|
security_group_id = aws_security_group.controller.id
|
||||||
|
|
||||||
|
type = "ingress"
|
||||||
|
protocol = "tcp"
|
||||||
|
from_port = 10251
|
||||||
|
to_port = 10251
|
||||||
|
source_security_group_id = aws_security_group.worker.id
|
||||||
|
}
|
||||||
|
|
||||||
|
# Allow Prometheus to scrape kube-controller-manager
|
||||||
|
resource "aws_security_group_rule" "controller-manager-metrics" {
|
||||||
|
security_group_id = aws_security_group.controller.id
|
||||||
|
|
||||||
|
type = "ingress"
|
||||||
|
protocol = "tcp"
|
||||||
|
from_port = 10252
|
||||||
|
to_port = 10252
|
||||||
|
source_security_group_id = aws_security_group.worker.id
|
||||||
|
}
|
||||||
|
|
||||||
# Allow Prometheus to scrape etcd metrics
|
# Allow Prometheus to scrape etcd metrics
|
||||||
resource "aws_security_group_rule" "controller-etcd-metrics" {
|
resource "aws_security_group_rule" "controller-etcd-metrics" {
|
||||||
security_group_id = aws_security_group.controller.id
|
security_group_id = aws_security_group.controller.id
|
||||||
|
@ -1,48 +1,57 @@
|
|||||||
# Secure copy etcd TLS assets to controllers.
|
# Secure copy assets to controllers.
|
||||||
resource "null_resource" "copy-controller-secrets" {
|
resource "null_resource" "copy-controller-secrets" {
|
||||||
count = var.controller_count
|
count = var.controller_count
|
||||||
|
|
||||||
|
depends_on = [
|
||||||
|
module.bootstrap,
|
||||||
|
]
|
||||||
|
|
||||||
connection {
|
connection {
|
||||||
type = "ssh"
|
type = "ssh"
|
||||||
host = element(aws_instance.controllers.*.public_ip, count.index)
|
host = aws_instance.controllers.*.public_ip[count.index]
|
||||||
user = "core"
|
user = "core"
|
||||||
timeout = "15m"
|
timeout = "15m"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.etcd_ca_cert
|
content = module.bootstrap.etcd_ca_cert
|
||||||
destination = "$HOME/etcd-client-ca.crt"
|
destination = "$HOME/etcd-client-ca.crt"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.etcd_client_cert
|
content = module.bootstrap.etcd_client_cert
|
||||||
destination = "$HOME/etcd-client.crt"
|
destination = "$HOME/etcd-client.crt"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.etcd_client_key
|
content = module.bootstrap.etcd_client_key
|
||||||
destination = "$HOME/etcd-client.key"
|
destination = "$HOME/etcd-client.key"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.etcd_server_cert
|
content = module.bootstrap.etcd_server_cert
|
||||||
destination = "$HOME/etcd-server.crt"
|
destination = "$HOME/etcd-server.crt"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.etcd_server_key
|
content = module.bootstrap.etcd_server_key
|
||||||
destination = "$HOME/etcd-server.key"
|
destination = "$HOME/etcd-server.key"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.etcd_peer_cert
|
content = module.bootstrap.etcd_peer_cert
|
||||||
destination = "$HOME/etcd-peer.crt"
|
destination = "$HOME/etcd-peer.crt"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.etcd_peer_key
|
content = module.bootstrap.etcd_peer_key
|
||||||
destination = "$HOME/etcd-peer.key"
|
destination = "$HOME/etcd-peer.key"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
provisioner "file" {
|
||||||
|
source = var.asset_dir
|
||||||
|
destination = "$HOME/assets"
|
||||||
|
}
|
||||||
|
|
||||||
provisioner "remote-exec" {
|
provisioner "remote-exec" {
|
||||||
inline = [
|
inline = [
|
||||||
@ -56,18 +65,22 @@ resource "null_resource" "copy-controller-secrets" {
|
|||||||
"sudo mv etcd-peer.key /etc/ssl/etcd/etcd/peer.key",
|
"sudo mv etcd-peer.key /etc/ssl/etcd/etcd/peer.key",
|
||||||
"sudo chown -R etcd:etcd /etc/ssl/etcd",
|
"sudo chown -R etcd:etcd /etc/ssl/etcd",
|
||||||
"sudo chmod -R 500 /etc/ssl/etcd",
|
"sudo chmod -R 500 /etc/ssl/etcd",
|
||||||
|
"sudo mv $HOME/assets /opt/bootstrap/assets",
|
||||||
|
"sudo mkdir -p /etc/kubernetes/manifests",
|
||||||
|
"sudo mkdir -p /etc/kubernetes/bootstrap-secrets",
|
||||||
|
"sudo cp -r /opt/bootstrap/assets/tls/* /etc/kubernetes/bootstrap-secrets/",
|
||||||
|
"sudo cp /opt/bootstrap/assets/auth/kubeconfig /etc/kubernetes/bootstrap-secrets/",
|
||||||
|
"sudo cp -r /opt/bootstrap/assets/static-manifests/* /etc/kubernetes/manifests/",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Secure copy bootkube assets to ONE controller and start bootkube to perform
|
# Connect to a controller to perform one-time cluster bootstrap.
|
||||||
# one-time self-hosted cluster bootstrapping.
|
resource "null_resource" "bootstrap" {
|
||||||
resource "null_resource" "bootkube-start" {
|
|
||||||
depends_on = [
|
depends_on = [
|
||||||
module.bootkube,
|
null_resource.copy-controller-secrets,
|
||||||
module.workers,
|
module.workers,
|
||||||
aws_route53_record.apiserver,
|
aws_route53_record.apiserver,
|
||||||
null_resource.copy-controller-secrets,
|
|
||||||
]
|
]
|
||||||
|
|
||||||
connection {
|
connection {
|
||||||
@ -77,15 +90,9 @@ resource "null_resource" "bootkube-start" {
|
|||||||
timeout = "15m"
|
timeout = "15m"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
|
||||||
source = var.asset_dir
|
|
||||||
destination = "$HOME/assets"
|
|
||||||
}
|
|
||||||
|
|
||||||
provisioner "remote-exec" {
|
provisioner "remote-exec" {
|
||||||
inline = [
|
inline = [
|
||||||
"sudo mv $HOME/assets /opt/bootkube",
|
"sudo systemctl start bootstrap",
|
||||||
"sudo systemctl start bootkube",
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,57 +18,57 @@ variable "dns_zone_id" {
|
|||||||
# instances
|
# instances
|
||||||
|
|
||||||
variable "controller_count" {
|
variable "controller_count" {
|
||||||
type = string
|
type = number
|
||||||
default = "1"
|
|
||||||
description = "Number of controllers (i.e. masters)"
|
description = "Number of controllers (i.e. masters)"
|
||||||
|
default = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "worker_count" {
|
variable "worker_count" {
|
||||||
type = string
|
type = number
|
||||||
default = "1"
|
|
||||||
description = "Number of workers"
|
description = "Number of workers"
|
||||||
|
default = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "controller_type" {
|
variable "controller_type" {
|
||||||
type = string
|
type = string
|
||||||
default = "t3.small"
|
|
||||||
description = "EC2 instance type for controllers"
|
description = "EC2 instance type for controllers"
|
||||||
|
default = "t3.small"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "worker_type" {
|
variable "worker_type" {
|
||||||
type = string
|
type = string
|
||||||
default = "t3.small"
|
|
||||||
description = "EC2 instance type for workers"
|
description = "EC2 instance type for workers"
|
||||||
|
default = "t3.small"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "os_image" {
|
variable "os_image" {
|
||||||
type = string
|
type = string
|
||||||
default = "coreos-stable"
|
|
||||||
description = "AMI channel for a Container Linux derivative (coreos-stable, coreos-beta, coreos-alpha, flatcar-stable, flatcar-beta, flatcar-alpha, flatcar-edge)"
|
description = "AMI channel for a Container Linux derivative (coreos-stable, coreos-beta, coreos-alpha, flatcar-stable, flatcar-beta, flatcar-alpha, flatcar-edge)"
|
||||||
|
default = "coreos-stable"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "disk_size" {
|
variable "disk_size" {
|
||||||
type = string
|
type = number
|
||||||
default = "40"
|
|
||||||
description = "Size of the EBS volume in GB"
|
description = "Size of the EBS volume in GB"
|
||||||
|
default = 40
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "disk_type" {
|
variable "disk_type" {
|
||||||
type = string
|
type = string
|
||||||
default = "gp2"
|
|
||||||
description = "Type of the EBS volume (e.g. standard, gp2, io1)"
|
description = "Type of the EBS volume (e.g. standard, gp2, io1)"
|
||||||
|
default = "gp2"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "disk_iops" {
|
variable "disk_iops" {
|
||||||
type = string
|
type = number
|
||||||
default = "0"
|
|
||||||
description = "IOPS of the EBS volume (e.g. 100)"
|
description = "IOPS of the EBS volume (e.g. 100)"
|
||||||
|
default = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "worker_price" {
|
variable "worker_price" {
|
||||||
type = string
|
type = number
|
||||||
default = ""
|
description = "Spot price in USD for worker instances or 0 to use on-demand instances"
|
||||||
description = "Spot price in USD for autoscaling group spot instances. Leave as default empty string for autoscaling group to use on-demand instances. Note, switching in-place from spot to on-demand is not possible: https://github.com/terraform-providers/terraform-provider-aws/issues/4320"
|
default = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "worker_target_groups" {
|
variable "worker_target_groups" {
|
||||||
@ -97,60 +97,66 @@ variable "ssh_authorized_key" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
variable "asset_dir" {
|
variable "asset_dir" {
|
||||||
description = "Path to a directory where generated assets should be placed (contains secrets)"
|
|
||||||
type = string
|
type = string
|
||||||
|
description = "Absolute path to a directory where generated assets should be placed (contains secrets)"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "networking" {
|
variable "networking" {
|
||||||
description = "Choice of networking provider (calico or flannel)"
|
|
||||||
type = string
|
type = string
|
||||||
|
description = "Choice of networking provider (calico or flannel)"
|
||||||
default = "calico"
|
default = "calico"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "network_mtu" {
|
variable "network_mtu" {
|
||||||
|
type = number
|
||||||
description = "CNI interface MTU (applies to calico only). Use 8981 if using instances types with Jumbo frames."
|
description = "CNI interface MTU (applies to calico only). Use 8981 if using instances types with Jumbo frames."
|
||||||
type = string
|
default = 1480
|
||||||
default = "1480"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "host_cidr" {
|
variable "host_cidr" {
|
||||||
description = "CIDR IPv4 range to assign to EC2 nodes"
|
|
||||||
type = string
|
type = string
|
||||||
|
description = "CIDR IPv4 range to assign to EC2 nodes"
|
||||||
default = "10.0.0.0/16"
|
default = "10.0.0.0/16"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "pod_cidr" {
|
variable "pod_cidr" {
|
||||||
description = "CIDR IPv4 range to assign Kubernetes pods"
|
|
||||||
type = string
|
type = string
|
||||||
|
description = "CIDR IPv4 range to assign Kubernetes pods"
|
||||||
default = "10.2.0.0/16"
|
default = "10.2.0.0/16"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "service_cidr" {
|
variable "service_cidr" {
|
||||||
|
type = string
|
||||||
description = <<EOD
|
description = <<EOD
|
||||||
CIDR IPv4 range to assign Kubernetes services.
|
CIDR IPv4 range to assign Kubernetes services.
|
||||||
The 1st IP will be reserved for kube_apiserver, the 10th IP will be reserved for coredns.
|
The 1st IP will be reserved for kube_apiserver, the 10th IP will be reserved for coredns.
|
||||||
EOD
|
EOD
|
||||||
|
|
||||||
|
|
||||||
type = string
|
|
||||||
default = "10.3.0.0/16"
|
default = "10.3.0.0/16"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "cluster_domain_suffix" {
|
|
||||||
description = "Queries for domains with the suffix will be answered by coredns. Default is cluster.local (e.g. foo.default.svc.cluster.local) "
|
|
||||||
type = string
|
|
||||||
default = "cluster.local"
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "enable_reporting" {
|
variable "enable_reporting" {
|
||||||
type = string
|
type = bool
|
||||||
description = "Enable usage or analytics reporting to upstreams (Calico)"
|
description = "Enable usage or analytics reporting to upstreams (Calico)"
|
||||||
default = "false"
|
default = false
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "enable_aggregation" {
|
variable "enable_aggregation" {
|
||||||
|
type = bool
|
||||||
description = "Enable the Kubernetes Aggregation Layer (defaults to false)"
|
description = "Enable the Kubernetes Aggregation Layer (defaults to false)"
|
||||||
type = string
|
default = false
|
||||||
default = "false"
|
}
|
||||||
|
|
||||||
|
variable "worker_node_labels" {
|
||||||
|
type = list(string)
|
||||||
|
description = "List of initial worker node labels"
|
||||||
|
default = []
|
||||||
|
}
|
||||||
|
|
||||||
|
# unofficial, undocumented, unsupported
|
||||||
|
|
||||||
|
variable "cluster_domain_suffix" {
|
||||||
|
type = string
|
||||||
|
description = "Queries for domains with the suffix will be answered by CoreDNS. Default is cluster.local (e.g. foo.default.svc.cluster.local)"
|
||||||
|
default = "cluster.local"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
terraform {
|
terraform {
|
||||||
required_version = "~> 0.12.0"
|
required_version = "~> 0.12.0"
|
||||||
required_providers {
|
required_providers {
|
||||||
aws = "~> 2.7"
|
aws = "~> 2.23"
|
||||||
ct = "~> 0.3"
|
ct = "~> 0.3"
|
||||||
template = "~> 2.1"
|
template = "~> 2.1"
|
||||||
null = "~> 2.1"
|
null = "~> 2.1"
|
||||||
|
@ -14,10 +14,11 @@ module "workers" {
|
|||||||
target_groups = var.worker_target_groups
|
target_groups = var.worker_target_groups
|
||||||
|
|
||||||
# configuration
|
# configuration
|
||||||
kubeconfig = module.bootkube.kubeconfig-kubelet
|
kubeconfig = module.bootstrap.kubeconfig-kubelet
|
||||||
ssh_authorized_key = var.ssh_authorized_key
|
ssh_authorized_key = var.ssh_authorized_key
|
||||||
service_cidr = var.service_cidr
|
service_cidr = var.service_cidr
|
||||||
cluster_domain_suffix = var.cluster_domain_suffix
|
cluster_domain_suffix = var.cluster_domain_suffix
|
||||||
clc_snippets = var.worker_clc_snippets
|
clc_snippets = var.worker_clc_snippets
|
||||||
|
node_labels = var.worker_node_labels
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,9 +39,9 @@ systemd:
|
|||||||
--mount volume=var-log,target=/var/log \
|
--mount volume=var-log,target=/var/log \
|
||||||
--insecure-options=image"
|
--insecure-options=image"
|
||||||
Environment=KUBELET_CGROUP_DRIVER=${cgroup_driver}
|
Environment=KUBELET_CGROUP_DRIVER=${cgroup_driver}
|
||||||
ExecStartPre=/bin/mkdir -p /opt/cni/bin
|
|
||||||
ExecStartPre=/bin/mkdir -p /etc/kubernetes/manifests
|
ExecStartPre=/bin/mkdir -p /etc/kubernetes/manifests
|
||||||
ExecStartPre=/bin/mkdir -p /etc/kubernetes/cni/net.d
|
ExecStartPre=/bin/mkdir -p /etc/kubernetes/cni/net.d
|
||||||
|
ExecStartPre=/bin/mkdir -p /opt/cni/bin
|
||||||
ExecStartPre=/bin/mkdir -p /var/lib/cni
|
ExecStartPre=/bin/mkdir -p /var/lib/cni
|
||||||
ExecStartPre=/bin/mkdir -p /var/lib/calico
|
ExecStartPre=/bin/mkdir -p /var/lib/calico
|
||||||
ExecStartPre=/bin/mkdir -p /var/lib/kubelet/volumeplugins
|
ExecStartPre=/bin/mkdir -p /var/lib/kubelet/volumeplugins
|
||||||
@ -60,7 +60,10 @@ systemd:
|
|||||||
--kubeconfig=/etc/kubernetes/kubeconfig \
|
--kubeconfig=/etc/kubernetes/kubeconfig \
|
||||||
--lock-file=/var/run/lock/kubelet.lock \
|
--lock-file=/var/run/lock/kubelet.lock \
|
||||||
--network-plugin=cni \
|
--network-plugin=cni \
|
||||||
--node-labels=node-role.kubernetes.io/node \
|
--node-labels=node.kubernetes.io/node \
|
||||||
|
%{ for label in split(",", node_labels) }
|
||||||
|
--node-labels=${label} \
|
||||||
|
%{ endfor ~}
|
||||||
--pod-manifest-path=/etc/kubernetes/manifests \
|
--pod-manifest-path=/etc/kubernetes/manifests \
|
||||||
--read-only-port=0 \
|
--read-only-port=0 \
|
||||||
--volume-plugin-dir=/var/lib/kubelet/volumeplugins
|
--volume-plugin-dir=/var/lib/kubelet/volumeplugins
|
||||||
@ -95,7 +98,7 @@ storage:
|
|||||||
contents:
|
contents:
|
||||||
inline: |
|
inline: |
|
||||||
KUBELET_IMAGE_URL=docker://k8s.gcr.io/hyperkube
|
KUBELET_IMAGE_URL=docker://k8s.gcr.io/hyperkube
|
||||||
KUBELET_IMAGE_TAG=v1.15.1
|
KUBELET_IMAGE_TAG=v1.16.1
|
||||||
- path: /etc/sysctl.d/max-user-watches.conf
|
- path: /etc/sysctl.d/max-user-watches.conf
|
||||||
filesystem: root
|
filesystem: root
|
||||||
contents:
|
contents:
|
||||||
@ -113,7 +116,7 @@ storage:
|
|||||||
--volume config,kind=host,source=/etc/kubernetes \
|
--volume config,kind=host,source=/etc/kubernetes \
|
||||||
--mount volume=config,target=/etc/kubernetes \
|
--mount volume=config,target=/etc/kubernetes \
|
||||||
--insecure-options=image \
|
--insecure-options=image \
|
||||||
docker://k8s.gcr.io/hyperkube:v1.15.1 \
|
docker://k8s.gcr.io/hyperkube:v1.16.1 \
|
||||||
--net=host \
|
--net=host \
|
||||||
--dns=host \
|
--dns=host \
|
||||||
--exec=/kubectl -- --kubeconfig=/etc/kubernetes/kubeconfig delete node $(hostname)
|
--exec=/kubectl -- --kubeconfig=/etc/kubernetes/kubeconfig delete node $(hostname)
|
||||||
|
@ -23,45 +23,45 @@ variable "security_groups" {
|
|||||||
# instances
|
# instances
|
||||||
|
|
||||||
variable "worker_count" {
|
variable "worker_count" {
|
||||||
type = string
|
type = number
|
||||||
default = "1"
|
|
||||||
description = "Number of instances"
|
description = "Number of instances"
|
||||||
|
default = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "instance_type" {
|
variable "instance_type" {
|
||||||
type = string
|
type = string
|
||||||
default = "t3.small"
|
|
||||||
description = "EC2 instance type"
|
description = "EC2 instance type"
|
||||||
|
default = "t3.small"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "os_image" {
|
variable "os_image" {
|
||||||
type = string
|
type = string
|
||||||
default = "coreos-stable"
|
|
||||||
description = "AMI channel for a Container Linux derivative (coreos-stable, coreos-beta, coreos-alpha, flatcar-stable, flatcar-beta, flatcar-alpha, flatcar-edge)"
|
description = "AMI channel for a Container Linux derivative (coreos-stable, coreos-beta, coreos-alpha, flatcar-stable, flatcar-beta, flatcar-alpha, flatcar-edge)"
|
||||||
|
default = "coreos-stable"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "disk_size" {
|
variable "disk_size" {
|
||||||
type = string
|
type = number
|
||||||
default = "40"
|
|
||||||
description = "Size of the EBS volume in GB"
|
description = "Size of the EBS volume in GB"
|
||||||
|
default = 40
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "disk_type" {
|
variable "disk_type" {
|
||||||
type = string
|
type = string
|
||||||
default = "gp2"
|
|
||||||
description = "Type of the EBS volume (e.g. standard, gp2, io1)"
|
description = "Type of the EBS volume (e.g. standard, gp2, io1)"
|
||||||
|
default = "gp2"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "disk_iops" {
|
variable "disk_iops" {
|
||||||
type = string
|
type = number
|
||||||
default = "0"
|
|
||||||
description = "IOPS of the EBS volume (required for io1)"
|
description = "IOPS of the EBS volume (required for io1)"
|
||||||
|
default = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "spot_price" {
|
variable "spot_price" {
|
||||||
type = string
|
type = number
|
||||||
default = ""
|
description = "Spot price in USD for worker instances or 0 to use on-demand instances"
|
||||||
description = "Spot price in USD for autoscaling group spot instances. Leave as default empty string for autoscaling group to use on-demand instances. Note, switching in-place from spot to on-demand is not possible: https://github.com/terraform-providers/terraform-provider-aws/issues/4320"
|
default = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "target_groups" {
|
variable "target_groups" {
|
||||||
@ -89,19 +89,22 @@ variable "ssh_authorized_key" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
variable "service_cidr" {
|
variable "service_cidr" {
|
||||||
|
type = string
|
||||||
description = <<EOD
|
description = <<EOD
|
||||||
CIDR IPv4 range to assign Kubernetes services.
|
CIDR IPv4 range to assign Kubernetes services.
|
||||||
The 1st IP will be reserved for kube_apiserver, the 10th IP will be reserved for coredns.
|
The 1st IP will be reserved for kube_apiserver, the 10th IP will be reserved for coredns.
|
||||||
EOD
|
EOD
|
||||||
|
|
||||||
|
|
||||||
type = string
|
|
||||||
default = "10.3.0.0/16"
|
default = "10.3.0.0/16"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "cluster_domain_suffix" {
|
variable "cluster_domain_suffix" {
|
||||||
description = "Queries for domains with the suffix will be answered by coredns. Default is cluster.local (e.g. foo.default.svc.cluster.local) "
|
|
||||||
type = string
|
type = string
|
||||||
|
description = "Queries for domains with the suffix will be answered by coredns. Default is cluster.local (e.g. foo.default.svc.cluster.local) "
|
||||||
default = "cluster.local"
|
default = "cluster.local"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "node_labels" {
|
||||||
|
type = list(string)
|
||||||
|
description = "List of initial node labels"
|
||||||
|
default = []
|
||||||
|
}
|
||||||
|
@ -46,7 +46,7 @@ resource "aws_autoscaling_group" "workers" {
|
|||||||
resource "aws_launch_configuration" "worker" {
|
resource "aws_launch_configuration" "worker" {
|
||||||
image_id = local.ami_id
|
image_id = local.ami_id
|
||||||
instance_type = var.instance_type
|
instance_type = var.instance_type
|
||||||
spot_price = var.spot_price
|
spot_price = var.spot_price > 0 ? var.spot_price : null
|
||||||
enable_monitoring = false
|
enable_monitoring = false
|
||||||
|
|
||||||
user_data = data.ct_config.worker-ignition.rendered
|
user_data = data.ct_config.worker-ignition.rendered
|
||||||
@ -56,6 +56,7 @@ resource "aws_launch_configuration" "worker" {
|
|||||||
volume_type = var.disk_type
|
volume_type = var.disk_type
|
||||||
volume_size = var.disk_size
|
volume_size = var.disk_size
|
||||||
iops = var.disk_iops
|
iops = var.disk_iops
|
||||||
|
encrypted = true
|
||||||
}
|
}
|
||||||
|
|
||||||
# network
|
# network
|
||||||
@ -85,6 +86,7 @@ data "template_file" "worker-config" {
|
|||||||
cluster_dns_service_ip = cidrhost(var.service_cidr, 10)
|
cluster_dns_service_ip = cidrhost(var.service_cidr, 10)
|
||||||
cluster_domain_suffix = var.cluster_domain_suffix
|
cluster_domain_suffix = var.cluster_domain_suffix
|
||||||
cgroup_driver = local.flavor == "flatcar" && local.channel == "edge" ? "systemd" : "cgroupfs"
|
cgroup_driver = local.flavor == "flatcar" && local.channel == "edge" ? "systemd" : "cgroupfs"
|
||||||
|
node_labels = join(",", var.node_labels)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ Typhoon distributes upstream Kubernetes, architectural conventions, and cluster
|
|||||||
|
|
||||||
## Features <a href="https://www.cncf.io/certification/software-conformance/"><img align="right" src="https://storage.googleapis.com/poseidon/certified-kubernetes.png"></a>
|
## Features <a href="https://www.cncf.io/certification/software-conformance/"><img align="right" src="https://storage.googleapis.com/poseidon/certified-kubernetes.png"></a>
|
||||||
|
|
||||||
* Kubernetes v1.15.1 (upstream, via [kubernetes-incubator/bootkube](https://github.com/kubernetes-incubator/bootkube))
|
* Kubernetes v1.16.1 (upstream)
|
||||||
* Single or multi-master, [Calico](https://www.projectcalico.org/) or [flannel](https://github.com/coreos/flannel) networking
|
* Single or multi-master, [Calico](https://www.projectcalico.org/) or [flannel](https://github.com/coreos/flannel) networking
|
||||||
* On-cluster etcd with TLS, [RBAC](https://kubernetes.io/docs/admin/authorization/rbac/)-enabled, [network policy](https://kubernetes.io/docs/concepts/services-networking/network-policies/)
|
* On-cluster etcd with TLS, [RBAC](https://kubernetes.io/docs/admin/authorization/rbac/)-enabled, [network policy](https://kubernetes.io/docs/concepts/services-networking/network-policies/)
|
||||||
* Advanced features like [worker pools](https://typhoon.psdn.io/advanced/worker-pools/), [spot](https://typhoon.psdn.io/cl/aws/#spot) workers, and [snippets](https://typhoon.psdn.io/advanced/customization/#container-linux) customization
|
* Advanced features like [worker pools](https://typhoon.psdn.io/advanced/worker-pools/), [spot](https://typhoon.psdn.io/cl/aws/#spot) workers, and [snippets](https://typhoon.psdn.io/advanced/customization/#container-linux) customization
|
||||||
|
@ -13,9 +13,11 @@ data "aws_ami" "fedora-coreos" {
|
|||||||
values = ["hvm"]
|
values = ["hvm"]
|
||||||
}
|
}
|
||||||
|
|
||||||
// pin on known ok versions as preview matures
|
|
||||||
filter {
|
filter {
|
||||||
name = "name"
|
name = "name"
|
||||||
values = ["fedora-coreos-30.20190716.1-hvm"]
|
values = ["fedora-coreos-30.*.*-hvm"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# try to filter out dev images (AWS filters can't)
|
||||||
|
name_regex = "^fedora-coreos-30.[0-9]*.[0-9]*-hvm*"
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Self-hosted Kubernetes assets (kubeconfig, manifests)
|
# Kubernetes assets (kubeconfig, manifests)
|
||||||
module "bootkube" {
|
module "bootstrap" {
|
||||||
source = "git::https://github.com/poseidon/terraform-render-bootkube.git?ref=5b9faa903182505ac534f42a2cf250d5d215941b"
|
source = "git::https://github.com/poseidon/terraform-render-bootstrap.git?ref=586d6e36f67c56fb2283f317a7552638368c5779"
|
||||||
|
|
||||||
cluster_name = var.cluster_name
|
cluster_name = var.cluster_name
|
||||||
api_servers = [format("%s.%s", var.cluster_name, var.dns_zone)]
|
api_servers = [format("%s.%s", var.cluster_name, var.dns_zone)]
|
@ -31,6 +31,7 @@ resource "aws_instance" "controllers" {
|
|||||||
volume_type = var.disk_type
|
volume_type = var.disk_type
|
||||||
volume_size = var.disk_size
|
volume_size = var.disk_size
|
||||||
iops = var.disk_iops
|
iops = var.disk_iops
|
||||||
|
encrypted = true
|
||||||
}
|
}
|
||||||
|
|
||||||
# network
|
# network
|
||||||
@ -66,7 +67,7 @@ data "template_file" "controller-configs" {
|
|||||||
etcd_domain = "${var.cluster_name}-etcd${count.index}.${var.dns_zone}"
|
etcd_domain = "${var.cluster_name}-etcd${count.index}.${var.dns_zone}"
|
||||||
# etcd0=https://cluster-etcd0.example.com,etcd1=https://cluster-etcd1.example.com,...
|
# etcd0=https://cluster-etcd0.example.com,etcd1=https://cluster-etcd1.example.com,...
|
||||||
etcd_initial_cluster = join(",", data.template_file.etcds.*.rendered)
|
etcd_initial_cluster = join(",", data.template_file.etcds.*.rendered)
|
||||||
kubeconfig = indent(10, module.bootkube.kubeconfig-kubelet)
|
kubeconfig = indent(10, module.bootstrap.kubeconfig-kubelet)
|
||||||
ssh_authorized_key = var.ssh_authorized_key
|
ssh_authorized_key = var.ssh_authorized_key
|
||||||
cluster_dns_service_ip = cidrhost(var.service_cidr, 10)
|
cluster_dns_service_ip = cidrhost(var.service_cidr, 10)
|
||||||
cluster_domain_suffix = var.cluster_domain_suffix
|
cluster_domain_suffix = var.cluster_domain_suffix
|
||||||
|
@ -28,7 +28,7 @@ systemd:
|
|||||||
--network host \
|
--network host \
|
||||||
--volume /var/lib/etcd:/var/lib/etcd:rw,Z \
|
--volume /var/lib/etcd:/var/lib/etcd:rw,Z \
|
||||||
--volume /etc/ssl/etcd:/etc/ssl/certs:ro,Z \
|
--volume /etc/ssl/etcd:/etc/ssl/certs:ro,Z \
|
||||||
quay.io/coreos/etcd:v3.3.13
|
quay.io/coreos/etcd:v3.4.1
|
||||||
ExecStop=/usr/bin/podman stop etcd
|
ExecStop=/usr/bin/podman stop etcd
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
@ -56,9 +56,9 @@ systemd:
|
|||||||
[Service]
|
[Service]
|
||||||
ExecStartPre=/bin/mkdir -p /etc/kubernetes/cni/net.d
|
ExecStartPre=/bin/mkdir -p /etc/kubernetes/cni/net.d
|
||||||
ExecStartPre=/bin/mkdir -p /etc/kubernetes/manifests
|
ExecStartPre=/bin/mkdir -p /etc/kubernetes/manifests
|
||||||
|
ExecStartPre=/bin/mkdir -p /opt/cni/bin
|
||||||
ExecStartPre=/bin/mkdir -p /var/lib/calico
|
ExecStartPre=/bin/mkdir -p /var/lib/calico
|
||||||
ExecStartPre=/bin/mkdir -p /var/lib/kubelet/volumeplugins
|
ExecStartPre=/bin/mkdir -p /var/lib/kubelet/volumeplugins
|
||||||
ExecStartPre=/bin/mkdir -p /opt/cni/bin
|
|
||||||
ExecStartPre=/usr/bin/bash -c "grep 'certificate-authority-data' /etc/kubernetes/kubeconfig | awk '{print $2}' | base64 -d > /etc/kubernetes/ca.crt"
|
ExecStartPre=/usr/bin/bash -c "grep 'certificate-authority-data' /etc/kubernetes/kubeconfig | awk '{print $2}' | base64 -d > /etc/kubernetes/ca.crt"
|
||||||
ExecStartPre=-/usr/bin/podman rm kubelet
|
ExecStartPre=-/usr/bin/podman rm kubelet
|
||||||
ExecStart=/usr/bin/podman run --name kubelet \
|
ExecStart=/usr/bin/podman run --name kubelet \
|
||||||
@ -80,13 +80,13 @@ systemd:
|
|||||||
--volume /var/run:/var/run \
|
--volume /var/run:/var/run \
|
||||||
--volume /var/run/lock:/var/run/lock:z \
|
--volume /var/run/lock:/var/run/lock:z \
|
||||||
--volume /opt/cni/bin:/opt/cni/bin:z \
|
--volume /opt/cni/bin:/opt/cni/bin:z \
|
||||||
k8s.gcr.io/hyperkube:v1.15.1 /hyperkube kubelet \
|
k8s.gcr.io/hyperkube:v1.16.1 /hyperkube kubelet \
|
||||||
--anonymous-auth=false \
|
--anonymous-auth=false \
|
||||||
--authentication-token-webhook \
|
--authentication-token-webhook \
|
||||||
--authorization-mode=Webhook \
|
--authorization-mode=Webhook \
|
||||||
--cgroup-driver=systemd \
|
--cgroup-driver=systemd \
|
||||||
--cgroups-per-qos=false \
|
--cgroups-per-qos=true \
|
||||||
--enforce-node-allocatable="" \
|
--enforce-node-allocatable=pods \
|
||||||
--client-ca-file=/etc/kubernetes/ca.crt \
|
--client-ca-file=/etc/kubernetes/ca.crt \
|
||||||
--cluster_dns=${cluster_dns_service_ip} \
|
--cluster_dns=${cluster_dns_service_ip} \
|
||||||
--cluster_domain=${cluster_domain_suffix} \
|
--cluster_domain=${cluster_domain_suffix} \
|
||||||
@ -95,8 +95,8 @@ systemd:
|
|||||||
--kubeconfig=/etc/kubernetes/kubeconfig \
|
--kubeconfig=/etc/kubernetes/kubeconfig \
|
||||||
--lock-file=/var/run/lock/kubelet.lock \
|
--lock-file=/var/run/lock/kubelet.lock \
|
||||||
--network-plugin=cni \
|
--network-plugin=cni \
|
||||||
--node-labels=node-role.kubernetes.io/master \
|
--node-labels=node.kubernetes.io/master \
|
||||||
--node-labels=node-role.kubernetes.io/controller="true" \
|
--node-labels=node.kubernetes.io/controller="true" \
|
||||||
--pod-manifest-path=/etc/kubernetes/manifests \
|
--pod-manifest-path=/etc/kubernetes/manifests \
|
||||||
--read-only-port=0 \
|
--read-only-port=0 \
|
||||||
--register-with-taints=node-role.kubernetes.io/master=:NoSchedule \
|
--register-with-taints=node-role.kubernetes.io/master=:NoSchedule \
|
||||||
@ -107,33 +107,48 @@ systemd:
|
|||||||
RestartSec=10
|
RestartSec=10
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
- name: bootkube.service
|
- name: bootstrap.service
|
||||||
contents: |
|
contents: |
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Bootstrap a Kubernetes control plane
|
Description=Kubernetes control plane
|
||||||
ConditionPathExists=!/opt/bootkube/init_bootkube.done
|
ConditionPathExists=!/opt/bootstrap/bootstrap.done
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
RemainAfterExit=true
|
RemainAfterExit=true
|
||||||
WorkingDirectory=/opt/bootkube
|
WorkingDirectory=/opt/bootstrap
|
||||||
ExecStart=/usr/bin/bash -c 'set -x && \
|
ExecStartPre=-/usr/bin/bash -c 'set -x && [ -n "$(ls /opt/bootstrap/assets/manifests-*/* 2>/dev/null)" ] && mv /opt/bootstrap/assets/manifests-*/* /opt/bootstrap/assets/manifests && rm -rf /opt/bootstrap/assets/manifests-*'
|
||||||
[ -n "$(ls /opt/bootkube/assets/manifests-*/* 2>/dev/null)" ] && mv /opt/bootkube/assets/manifests-*/* /opt/bootkube/assets/manifests && rm -rf /opt/bootkube/assets/manifests-* && exec podman run --name bootkube --privileged \
|
ExecStart=/usr/bin/podman run --name bootstrap \
|
||||||
--network host \
|
--network host \
|
||||||
--volume /opt/bootkube/assets:/assets \
|
--volume /opt/bootstrap/assets:/assets:ro,Z \
|
||||||
--volume /etc/kubernetes:/etc/kubernetes \
|
--volume /opt/bootstrap/apply:/apply:ro,Z \
|
||||||
quay.io/coreos/bootkube:v0.14.0 \
|
k8s.gcr.io/hyperkube:v1.16.1 \
|
||||||
/bootkube start --asset-dir=/assets'
|
/apply
|
||||||
ExecStartPost=/bin/touch /opt/bootkube/init_bootkube.done
|
ExecStartPost=/bin/touch /opt/bootstrap/bootstrap.done
|
||||||
|
ExecStartPost=-/usr/bin/podman stop bootstrap
|
||||||
storage:
|
storage:
|
||||||
directories:
|
directories:
|
||||||
- path: /etc/kubernetes
|
- path: /etc/kubernetes
|
||||||
- path: /opt/bootkube
|
- path: /opt/bootstrap
|
||||||
files:
|
files:
|
||||||
- path: /etc/kubernetes/kubeconfig
|
- path: /etc/kubernetes/kubeconfig
|
||||||
mode: 0644
|
mode: 0644
|
||||||
contents:
|
contents:
|
||||||
inline: |
|
inline: |
|
||||||
${kubeconfig}
|
${kubeconfig}
|
||||||
|
- path: /opt/bootstrap/apply
|
||||||
|
mode: 0544
|
||||||
|
contents:
|
||||||
|
inline: |
|
||||||
|
#!/bin/bash -e
|
||||||
|
export KUBECONFIG=/assets/auth/kubeconfig
|
||||||
|
until kubectl version; do
|
||||||
|
echo "Waiting for static pod control plane"
|
||||||
|
sleep 5
|
||||||
|
done
|
||||||
|
until kubectl apply -f /assets/manifests -R; do
|
||||||
|
echo "Retry applying manifests"
|
||||||
|
sleep 5
|
||||||
|
done
|
||||||
- path: /etc/sysctl.d/reverse-path-filter.conf
|
- path: /etc/sysctl.d/reverse-path-filter.conf
|
||||||
contents:
|
contents:
|
||||||
inline: |
|
inline: |
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
output "kubeconfig-admin" {
|
output "kubeconfig-admin" {
|
||||||
value = module.bootkube.kubeconfig-admin
|
value = module.bootstrap.kubeconfig-admin
|
||||||
}
|
}
|
||||||
|
|
||||||
# Outputs for Kubernetes Ingress
|
# Outputs for Kubernetes Ingress
|
||||||
@ -32,7 +32,7 @@ output "worker_security_groups" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
output "kubeconfig" {
|
output "kubeconfig" {
|
||||||
value = module.bootkube.kubeconfig-kubelet
|
value = module.bootstrap.kubeconfig-kubelet
|
||||||
}
|
}
|
||||||
|
|
||||||
# Outputs for custom load balancing
|
# Outputs for custom load balancing
|
||||||
|
@ -44,6 +44,28 @@ resource "aws_security_group_rule" "controller-etcd-metrics" {
|
|||||||
source_security_group_id = aws_security_group.worker.id
|
source_security_group_id = aws_security_group.worker.id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Allow Prometheus to scrape kube-scheduler
|
||||||
|
resource "aws_security_group_rule" "controller-scheduler-metrics" {
|
||||||
|
security_group_id = aws_security_group.controller.id
|
||||||
|
|
||||||
|
type = "ingress"
|
||||||
|
protocol = "tcp"
|
||||||
|
from_port = 10251
|
||||||
|
to_port = 10251
|
||||||
|
source_security_group_id = aws_security_group.worker.id
|
||||||
|
}
|
||||||
|
|
||||||
|
# Allow Prometheus to scrape kube-controller-manager
|
||||||
|
resource "aws_security_group_rule" "controller-manager-metrics" {
|
||||||
|
security_group_id = aws_security_group.controller.id
|
||||||
|
|
||||||
|
type = "ingress"
|
||||||
|
protocol = "tcp"
|
||||||
|
from_port = 10252
|
||||||
|
to_port = 10252
|
||||||
|
source_security_group_id = aws_security_group.worker.id
|
||||||
|
}
|
||||||
|
|
||||||
resource "aws_security_group_rule" "controller-vxlan" {
|
resource "aws_security_group_rule" "controller-vxlan" {
|
||||||
count = var.networking == "flannel" ? 1 : 0
|
count = var.networking == "flannel" ? 1 : 0
|
||||||
|
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
# Secure copy etcd TLS assets to controllers.
|
# Secure copy assets to controllers.
|
||||||
resource "null_resource" "copy-controller-secrets" {
|
resource "null_resource" "copy-controller-secrets" {
|
||||||
count = var.controller_count
|
count = var.controller_count
|
||||||
|
|
||||||
|
depends_on = [
|
||||||
|
module.bootstrap,
|
||||||
|
]
|
||||||
|
|
||||||
connection {
|
connection {
|
||||||
type = "ssh"
|
type = "ssh"
|
||||||
@ -10,40 +14,45 @@ resource "null_resource" "copy-controller-secrets" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.etcd_ca_cert
|
content = module.bootstrap.etcd_ca_cert
|
||||||
destination = "$HOME/etcd-client-ca.crt"
|
destination = "$HOME/etcd-client-ca.crt"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.etcd_client_cert
|
content = module.bootstrap.etcd_client_cert
|
||||||
destination = "$HOME/etcd-client.crt"
|
destination = "$HOME/etcd-client.crt"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.etcd_client_key
|
content = module.bootstrap.etcd_client_key
|
||||||
destination = "$HOME/etcd-client.key"
|
destination = "$HOME/etcd-client.key"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.etcd_server_cert
|
content = module.bootstrap.etcd_server_cert
|
||||||
destination = "$HOME/etcd-server.crt"
|
destination = "$HOME/etcd-server.crt"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.etcd_server_key
|
content = module.bootstrap.etcd_server_key
|
||||||
destination = "$HOME/etcd-server.key"
|
destination = "$HOME/etcd-server.key"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.etcd_peer_cert
|
content = module.bootstrap.etcd_peer_cert
|
||||||
destination = "$HOME/etcd-peer.crt"
|
destination = "$HOME/etcd-peer.crt"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.etcd_peer_key
|
content = module.bootstrap.etcd_peer_key
|
||||||
destination = "$HOME/etcd-peer.key"
|
destination = "$HOME/etcd-peer.key"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
provisioner "file" {
|
||||||
|
source = var.asset_dir
|
||||||
|
destination = "$HOME/assets"
|
||||||
|
}
|
||||||
|
|
||||||
provisioner "remote-exec" {
|
provisioner "remote-exec" {
|
||||||
inline = [
|
inline = [
|
||||||
"sudo mkdir -p /etc/ssl/etcd/etcd",
|
"sudo mkdir -p /etc/ssl/etcd/etcd",
|
||||||
@ -56,18 +65,22 @@ resource "null_resource" "copy-controller-secrets" {
|
|||||||
"sudo mv etcd-peer.key /etc/ssl/etcd/etcd/peer.key",
|
"sudo mv etcd-peer.key /etc/ssl/etcd/etcd/peer.key",
|
||||||
"sudo chown -R etcd:etcd /etc/ssl/etcd",
|
"sudo chown -R etcd:etcd /etc/ssl/etcd",
|
||||||
"sudo chmod -R 500 /etc/ssl/etcd",
|
"sudo chmod -R 500 /etc/ssl/etcd",
|
||||||
|
"sudo mv $HOME/assets /opt/bootstrap/assets",
|
||||||
|
"sudo mkdir -p /etc/kubernetes/manifests",
|
||||||
|
"sudo mkdir -p /etc/kubernetes/bootstrap-secrets",
|
||||||
|
"sudo cp -r /opt/bootstrap/assets/tls/* /etc/kubernetes/bootstrap-secrets/",
|
||||||
|
"sudo cp /opt/bootstrap/assets/auth/kubeconfig /etc/kubernetes/bootstrap-secrets/",
|
||||||
|
"sudo cp -r /opt/bootstrap/assets/static-manifests/* /etc/kubernetes/manifests/"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Secure copy bootkube assets to ONE controller and start bootkube to perform
|
# Connect to a controller to perform one-time cluster bootstrap.
|
||||||
# one-time self-hosted cluster bootstrapping.
|
resource "null_resource" "bootstrap" {
|
||||||
resource "null_resource" "bootkube-start" {
|
|
||||||
depends_on = [
|
depends_on = [
|
||||||
module.bootkube,
|
null_resource.copy-controller-secrets,
|
||||||
module.workers,
|
module.workers,
|
||||||
aws_route53_record.apiserver,
|
aws_route53_record.apiserver,
|
||||||
null_resource.copy-controller-secrets,
|
|
||||||
]
|
]
|
||||||
|
|
||||||
connection {
|
connection {
|
||||||
@ -77,15 +90,9 @@ resource "null_resource" "bootkube-start" {
|
|||||||
timeout = "15m"
|
timeout = "15m"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
|
||||||
source = var.asset_dir
|
|
||||||
destination = "$HOME/assets"
|
|
||||||
}
|
|
||||||
|
|
||||||
provisioner "remote-exec" {
|
provisioner "remote-exec" {
|
||||||
inline = [
|
inline = [
|
||||||
"sudo mv $HOME/assets /opt/bootkube",
|
"sudo systemctl start bootstrap",
|
||||||
"sudo systemctl start bootkube",
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,57 +18,57 @@ variable "dns_zone_id" {
|
|||||||
# instances
|
# instances
|
||||||
|
|
||||||
variable "controller_count" {
|
variable "controller_count" {
|
||||||
type = string
|
type = number
|
||||||
default = "1"
|
|
||||||
description = "Number of controllers (i.e. masters)"
|
description = "Number of controllers (i.e. masters)"
|
||||||
|
default = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "worker_count" {
|
variable "worker_count" {
|
||||||
type = string
|
type = number
|
||||||
default = "1"
|
|
||||||
description = "Number of workers"
|
description = "Number of workers"
|
||||||
|
default = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "controller_type" {
|
variable "controller_type" {
|
||||||
type = string
|
type = string
|
||||||
default = "t3.small"
|
|
||||||
description = "EC2 instance type for controllers"
|
description = "EC2 instance type for controllers"
|
||||||
|
default = "t3.small"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "worker_type" {
|
variable "worker_type" {
|
||||||
type = string
|
type = string
|
||||||
default = "t3.small"
|
|
||||||
description = "EC2 instance type for workers"
|
description = "EC2 instance type for workers"
|
||||||
|
default = "t3.small"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "os_image" {
|
variable "os_image" {
|
||||||
type = string
|
type = string
|
||||||
default = "coreos-stable"
|
|
||||||
description = "AMI channel for Fedora CoreOS (not yet used)"
|
description = "AMI channel for Fedora CoreOS (not yet used)"
|
||||||
|
default = "coreos-stable"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "disk_size" {
|
variable "disk_size" {
|
||||||
type = string
|
type = number
|
||||||
default = "40"
|
|
||||||
description = "Size of the EBS volume in GB"
|
description = "Size of the EBS volume in GB"
|
||||||
|
default = 40
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "disk_type" {
|
variable "disk_type" {
|
||||||
type = string
|
type = string
|
||||||
default = "gp2"
|
|
||||||
description = "Type of the EBS volume (e.g. standard, gp2, io1)"
|
description = "Type of the EBS volume (e.g. standard, gp2, io1)"
|
||||||
|
default = "gp2"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "disk_iops" {
|
variable "disk_iops" {
|
||||||
type = string
|
type = number
|
||||||
default = "0"
|
|
||||||
description = "IOPS of the EBS volume (e.g. 100)"
|
description = "IOPS of the EBS volume (e.g. 100)"
|
||||||
|
default = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "worker_price" {
|
variable "worker_price" {
|
||||||
type = string
|
type = number
|
||||||
default = ""
|
description = "Spot price in USD for worker instances or 0 to use on-demand instances"
|
||||||
description = "Spot price in USD for autoscaling group spot instances. Leave as default empty string for autoscaling group to use on-demand instances. Note, switching in-place from spot to on-demand is not possible: https://github.com/terraform-providers/terraform-provider-aws/issues/4320"
|
default = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "worker_target_groups" {
|
variable "worker_target_groups" {
|
||||||
@ -97,60 +97,66 @@ variable "ssh_authorized_key" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
variable "asset_dir" {
|
variable "asset_dir" {
|
||||||
description = "Path to a directory where generated assets should be placed (contains secrets)"
|
|
||||||
type = string
|
type = string
|
||||||
|
description = "Absolute path to a directory where generated assets should be placed (contains secrets)"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "networking" {
|
variable "networking" {
|
||||||
description = "Choice of networking provider (calico or flannel)"
|
|
||||||
type = string
|
type = string
|
||||||
|
description = "Choice of networking provider (calico or flannel)"
|
||||||
default = "calico"
|
default = "calico"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "network_mtu" {
|
variable "network_mtu" {
|
||||||
|
type = number
|
||||||
description = "CNI interface MTU (applies to calico only). Use 8981 if using instances types with Jumbo frames."
|
description = "CNI interface MTU (applies to calico only). Use 8981 if using instances types with Jumbo frames."
|
||||||
type = string
|
default = 1480
|
||||||
default = "1480"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "host_cidr" {
|
variable "host_cidr" {
|
||||||
description = "CIDR IPv4 range to assign to EC2 nodes"
|
|
||||||
type = string
|
type = string
|
||||||
|
description = "CIDR IPv4 range to assign to EC2 nodes"
|
||||||
default = "10.0.0.0/16"
|
default = "10.0.0.0/16"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "pod_cidr" {
|
variable "pod_cidr" {
|
||||||
description = "CIDR IPv4 range to assign Kubernetes pods"
|
|
||||||
type = string
|
type = string
|
||||||
|
description = "CIDR IPv4 range to assign Kubernetes pods"
|
||||||
default = "10.2.0.0/16"
|
default = "10.2.0.0/16"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "service_cidr" {
|
variable "service_cidr" {
|
||||||
|
type = string
|
||||||
description = <<EOD
|
description = <<EOD
|
||||||
CIDR IPv4 range to assign Kubernetes services.
|
CIDR IPv4 range to assign Kubernetes services.
|
||||||
The 1st IP will be reserved for kube_apiserver, the 10th IP will be reserved for coredns.
|
The 1st IP will be reserved for kube_apiserver, the 10th IP will be reserved for coredns.
|
||||||
EOD
|
EOD
|
||||||
|
|
||||||
|
|
||||||
type = string
|
|
||||||
default = "10.3.0.0/16"
|
default = "10.3.0.0/16"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "cluster_domain_suffix" {
|
|
||||||
description = "Queries for domains with the suffix will be answered by coredns. Default is cluster.local (e.g. foo.default.svc.cluster.local) "
|
|
||||||
type = string
|
|
||||||
default = "cluster.local"
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "enable_reporting" {
|
variable "enable_reporting" {
|
||||||
type = string
|
type = bool
|
||||||
description = "Enable usage or analytics reporting to upstreams (Calico)"
|
description = "Enable usage or analytics reporting to upstreams (Calico)"
|
||||||
default = "false"
|
default = false
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "enable_aggregation" {
|
variable "enable_aggregation" {
|
||||||
|
type = bool
|
||||||
description = "Enable the Kubernetes Aggregation Layer (defaults to false)"
|
description = "Enable the Kubernetes Aggregation Layer (defaults to false)"
|
||||||
type = string
|
default = false
|
||||||
default = "false"
|
}
|
||||||
|
|
||||||
|
variable "worker_node_labels" {
|
||||||
|
type = list(string)
|
||||||
|
description = "List of initial worker node labels"
|
||||||
|
default = []
|
||||||
|
}
|
||||||
|
|
||||||
|
# unofficial, undocumented, unsupported
|
||||||
|
|
||||||
|
variable "cluster_domain_suffix" {
|
||||||
|
type = string
|
||||||
|
description = "Queries for domains with the suffix will be answered by CoreDNS. Default is cluster.local (e.g. foo.default.svc.cluster.local)"
|
||||||
|
default = "cluster.local"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
terraform {
|
terraform {
|
||||||
required_version = "~> 0.12.0"
|
required_version = "~> 0.12.0"
|
||||||
required_providers {
|
required_providers {
|
||||||
aws = "~> 2.7"
|
aws = "~> 2.23"
|
||||||
ct = "~> 0.4"
|
ct = "~> 0.4"
|
||||||
template = "~> 2.1"
|
template = "~> 2.1"
|
||||||
null = "~> 2.1"
|
null = "~> 2.1"
|
||||||
|
@ -14,10 +14,11 @@ module "workers" {
|
|||||||
target_groups = var.worker_target_groups
|
target_groups = var.worker_target_groups
|
||||||
|
|
||||||
# configuration
|
# configuration
|
||||||
kubeconfig = module.bootkube.kubeconfig-kubelet
|
kubeconfig = module.bootstrap.kubeconfig-kubelet
|
||||||
ssh_authorized_key = var.ssh_authorized_key
|
ssh_authorized_key = var.ssh_authorized_key
|
||||||
service_cidr = var.service_cidr
|
service_cidr = var.service_cidr
|
||||||
cluster_domain_suffix = var.cluster_domain_suffix
|
cluster_domain_suffix = var.cluster_domain_suffix
|
||||||
snippets = var.worker_snippets
|
snippets = var.worker_snippets
|
||||||
|
node_labels = var.worker_node_labels
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,9 +13,11 @@ data "aws_ami" "fedora-coreos" {
|
|||||||
values = ["hvm"]
|
values = ["hvm"]
|
||||||
}
|
}
|
||||||
|
|
||||||
// pin on known ok versions as preview matures
|
|
||||||
filter {
|
filter {
|
||||||
name = "name"
|
name = "name"
|
||||||
values = ["fedora-coreos-30.20190716.1-hvm"]
|
values = ["fedora-coreos-30.*.*-hvm"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# try to filter out dev images (AWS filters can't)
|
||||||
|
name_regex = "^fedora-coreos-30.[0-9]*.[0-9]*-hvm*"
|
||||||
}
|
}
|
||||||
|
@ -26,9 +26,9 @@ systemd:
|
|||||||
[Service]
|
[Service]
|
||||||
ExecStartPre=/bin/mkdir -p /etc/kubernetes/cni/net.d
|
ExecStartPre=/bin/mkdir -p /etc/kubernetes/cni/net.d
|
||||||
ExecStartPre=/bin/mkdir -p /etc/kubernetes/manifests
|
ExecStartPre=/bin/mkdir -p /etc/kubernetes/manifests
|
||||||
|
ExecStartPre=/bin/mkdir -p /opt/cni/bin
|
||||||
ExecStartPre=/bin/mkdir -p /var/lib/calico
|
ExecStartPre=/bin/mkdir -p /var/lib/calico
|
||||||
ExecStartPre=/bin/mkdir -p /var/lib/kubelet/volumeplugins
|
ExecStartPre=/bin/mkdir -p /var/lib/kubelet/volumeplugins
|
||||||
ExecStartPre=/bin/mkdir -p /opt/cni/bin
|
|
||||||
ExecStartPre=/usr/bin/bash -c "grep 'certificate-authority-data' /etc/kubernetes/kubeconfig | awk '{print $2}' | base64 -d > /etc/kubernetes/ca.crt"
|
ExecStartPre=/usr/bin/bash -c "grep 'certificate-authority-data' /etc/kubernetes/kubeconfig | awk '{print $2}' | base64 -d > /etc/kubernetes/ca.crt"
|
||||||
ExecStartPre=-/usr/bin/podman rm kubelet
|
ExecStartPre=-/usr/bin/podman rm kubelet
|
||||||
ExecStart=/usr/bin/podman run --name kubelet \
|
ExecStart=/usr/bin/podman run --name kubelet \
|
||||||
@ -50,7 +50,7 @@ systemd:
|
|||||||
--volume /var/run:/var/run \
|
--volume /var/run:/var/run \
|
||||||
--volume /var/run/lock:/var/run/lock:z \
|
--volume /var/run/lock:/var/run/lock:z \
|
||||||
--volume /opt/cni/bin:/opt/cni/bin:z \
|
--volume /opt/cni/bin:/opt/cni/bin:z \
|
||||||
k8s.gcr.io/hyperkube:v1.15.1 /hyperkube kubelet \
|
k8s.gcr.io/hyperkube:v1.16.1 /hyperkube kubelet \
|
||||||
--anonymous-auth=false \
|
--anonymous-auth=false \
|
||||||
--authentication-token-webhook \
|
--authentication-token-webhook \
|
||||||
--authorization-mode=Webhook \
|
--authorization-mode=Webhook \
|
||||||
@ -65,7 +65,10 @@ systemd:
|
|||||||
--kubeconfig=/etc/kubernetes/kubeconfig \
|
--kubeconfig=/etc/kubernetes/kubeconfig \
|
||||||
--lock-file=/var/run/lock/kubelet.lock \
|
--lock-file=/var/run/lock/kubelet.lock \
|
||||||
--network-plugin=cni \
|
--network-plugin=cni \
|
||||||
--node-labels=node-role.kubernetes.io/node \
|
--node-labels=node.kubernetes.io/node \
|
||||||
|
%{ for label in split(",", node_labels) }
|
||||||
|
--node-labels=${label} \
|
||||||
|
%{ endfor ~}
|
||||||
--pod-manifest-path=/etc/kubernetes/manifests \
|
--pod-manifest-path=/etc/kubernetes/manifests \
|
||||||
--read-only-port=0 \
|
--read-only-port=0 \
|
||||||
--volume-plugin-dir=/var/lib/kubelet/volumeplugins
|
--volume-plugin-dir=/var/lib/kubelet/volumeplugins
|
||||||
@ -78,7 +81,6 @@ systemd:
|
|||||||
storage:
|
storage:
|
||||||
directories:
|
directories:
|
||||||
- path: /etc/kubernetes
|
- path: /etc/kubernetes
|
||||||
- path: /opt/bootkube
|
|
||||||
files:
|
files:
|
||||||
- path: /etc/kubernetes/kubeconfig
|
- path: /etc/kubernetes/kubeconfig
|
||||||
mode: 0644
|
mode: 0644
|
||||||
|
@ -23,45 +23,45 @@ variable "security_groups" {
|
|||||||
# instances
|
# instances
|
||||||
|
|
||||||
variable "worker_count" {
|
variable "worker_count" {
|
||||||
type = string
|
type = number
|
||||||
default = "1"
|
|
||||||
description = "Number of instances"
|
description = "Number of instances"
|
||||||
|
default = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "instance_type" {
|
variable "instance_type" {
|
||||||
type = string
|
type = string
|
||||||
default = "t3.small"
|
|
||||||
description = "EC2 instance type"
|
description = "EC2 instance type"
|
||||||
|
default = "t3.small"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "os_image" {
|
variable "os_image" {
|
||||||
type = string
|
type = string
|
||||||
default = "coreos-stable"
|
|
||||||
description = "AMI channel for Fedora CoreOS (not yet used)"
|
description = "AMI channel for Fedora CoreOS (not yet used)"
|
||||||
|
default = "coreos-stable"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "disk_size" {
|
variable "disk_size" {
|
||||||
type = string
|
type = number
|
||||||
default = "40"
|
|
||||||
description = "Size of the EBS volume in GB"
|
description = "Size of the EBS volume in GB"
|
||||||
|
default = 40
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "disk_type" {
|
variable "disk_type" {
|
||||||
type = string
|
type = string
|
||||||
default = "gp2"
|
|
||||||
description = "Type of the EBS volume (e.g. standard, gp2, io1)"
|
description = "Type of the EBS volume (e.g. standard, gp2, io1)"
|
||||||
|
default = "gp2"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "disk_iops" {
|
variable "disk_iops" {
|
||||||
type = string
|
type = number
|
||||||
default = "0"
|
|
||||||
description = "IOPS of the EBS volume (required for io1)"
|
description = "IOPS of the EBS volume (required for io1)"
|
||||||
|
default = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "spot_price" {
|
variable "spot_price" {
|
||||||
type = string
|
type = number
|
||||||
default = ""
|
description = "Spot price in USD for worker instances or 0 to use on-demand instances"
|
||||||
description = "Spot price in USD for autoscaling group spot instances. Leave as default empty string for autoscaling group to use on-demand instances. Note, switching in-place from spot to on-demand is not possible: https://github.com/terraform-providers/terraform-provider-aws/issues/4320"
|
default = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "target_groups" {
|
variable "target_groups" {
|
||||||
@ -89,19 +89,22 @@ variable "ssh_authorized_key" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
variable "service_cidr" {
|
variable "service_cidr" {
|
||||||
|
type = string
|
||||||
description = <<EOD
|
description = <<EOD
|
||||||
CIDR IPv4 range to assign Kubernetes services.
|
CIDR IPv4 range to assign Kubernetes services.
|
||||||
The 1st IP will be reserved for kube_apiserver, the 10th IP will be reserved for coredns.
|
The 1st IP will be reserved for kube_apiserver, the 10th IP will be reserved for coredns.
|
||||||
EOD
|
EOD
|
||||||
|
|
||||||
|
|
||||||
type = string
|
|
||||||
default = "10.3.0.0/16"
|
default = "10.3.0.0/16"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "cluster_domain_suffix" {
|
variable "cluster_domain_suffix" {
|
||||||
description = "Queries for domains with the suffix will be answered by coredns. Default is cluster.local (e.g. foo.default.svc.cluster.local) "
|
|
||||||
type = string
|
type = string
|
||||||
|
description = "Queries for domains with the suffix will be answered by coredns. Default is cluster.local (e.g. foo.default.svc.cluster.local) "
|
||||||
default = "cluster.local"
|
default = "cluster.local"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "node_labels" {
|
||||||
|
type = list(string)
|
||||||
|
description = "List of initial node labels"
|
||||||
|
default = []
|
||||||
|
}
|
||||||
|
@ -46,7 +46,7 @@ resource "aws_autoscaling_group" "workers" {
|
|||||||
resource "aws_launch_configuration" "worker" {
|
resource "aws_launch_configuration" "worker" {
|
||||||
image_id = data.aws_ami.fedora-coreos.image_id
|
image_id = data.aws_ami.fedora-coreos.image_id
|
||||||
instance_type = var.instance_type
|
instance_type = var.instance_type
|
||||||
spot_price = var.spot_price
|
spot_price = var.spot_price > 0 ? var.spot_price : null
|
||||||
enable_monitoring = false
|
enable_monitoring = false
|
||||||
|
|
||||||
user_data = data.ct_config.worker-ignition.rendered
|
user_data = data.ct_config.worker-ignition.rendered
|
||||||
@ -56,6 +56,7 @@ resource "aws_launch_configuration" "worker" {
|
|||||||
volume_type = var.disk_type
|
volume_type = var.disk_type
|
||||||
volume_size = var.disk_size
|
volume_size = var.disk_size
|
||||||
iops = var.disk_iops
|
iops = var.disk_iops
|
||||||
|
encrypted = true
|
||||||
}
|
}
|
||||||
|
|
||||||
# network
|
# network
|
||||||
@ -84,6 +85,7 @@ data "template_file" "worker-config" {
|
|||||||
ssh_authorized_key = var.ssh_authorized_key
|
ssh_authorized_key = var.ssh_authorized_key
|
||||||
cluster_dns_service_ip = cidrhost(var.service_cidr, 10)
|
cluster_dns_service_ip = cidrhost(var.service_cidr, 10)
|
||||||
cluster_domain_suffix = var.cluster_domain_suffix
|
cluster_domain_suffix = var.cluster_domain_suffix
|
||||||
|
node_labels = join(",", var.node_labels)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ Typhoon distributes upstream Kubernetes, architectural conventions, and cluster
|
|||||||
|
|
||||||
## Features <a href="https://www.cncf.io/certification/software-conformance/"><img align="right" src="https://storage.googleapis.com/poseidon/certified-kubernetes.png"></a>
|
## Features <a href="https://www.cncf.io/certification/software-conformance/"><img align="right" src="https://storage.googleapis.com/poseidon/certified-kubernetes.png"></a>
|
||||||
|
|
||||||
* Kubernetes v1.15.1 (upstream, via [kubernetes-incubator/bootkube](https://github.com/kubernetes-incubator/bootkube))
|
* Kubernetes v1.16.1 (upstream)
|
||||||
* Single or multi-master, [Calico](https://www.projectcalico.org/) or [flannel](https://github.com/coreos/flannel) networking
|
* Single or multi-master, [Calico](https://www.projectcalico.org/) or [flannel](https://github.com/coreos/flannel) networking
|
||||||
* On-cluster etcd with TLS, [RBAC](https://kubernetes.io/docs/admin/authorization/rbac/)-enabled, [network policy](https://kubernetes.io/docs/concepts/services-networking/network-policies/)
|
* On-cluster etcd with TLS, [RBAC](https://kubernetes.io/docs/admin/authorization/rbac/)-enabled, [network policy](https://kubernetes.io/docs/concepts/services-networking/network-policies/)
|
||||||
* Advanced features like [worker pools](https://typhoon.psdn.io/advanced/worker-pools/), [low-priority](https://typhoon.psdn.io/cl/azure/#low-priority) workers, and [snippets](https://typhoon.psdn.io/advanced/customization/#container-linux) customization
|
* Advanced features like [worker pools](https://typhoon.psdn.io/advanced/worker-pools/), [low-priority](https://typhoon.psdn.io/cl/azure/#low-priority) workers, and [snippets](https://typhoon.psdn.io/advanced/customization/#container-linux) customization
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Self-hosted Kubernetes assets (kubeconfig, manifests)
|
# Kubernetes assets (kubeconfig, manifests)
|
||||||
module "bootkube" {
|
module "bootstrap" {
|
||||||
source = "git::https://github.com/poseidon/terraform-render-bootkube.git?ref=5b9faa903182505ac534f42a2cf250d5d215941b"
|
source = "git::https://github.com/poseidon/terraform-render-bootstrap.git?ref=586d6e36f67c56fb2283f317a7552638368c5779"
|
||||||
|
|
||||||
cluster_name = var.cluster_name
|
cluster_name = var.cluster_name
|
||||||
api_servers = [format("%s.%s", var.cluster_name, var.dns_zone)]
|
api_servers = [format("%s.%s", var.cluster_name, var.dns_zone)]
|
@ -7,7 +7,7 @@ systemd:
|
|||||||
- name: 40-etcd-cluster.conf
|
- name: 40-etcd-cluster.conf
|
||||||
contents: |
|
contents: |
|
||||||
[Service]
|
[Service]
|
||||||
Environment="ETCD_IMAGE_TAG=v3.3.13"
|
Environment="ETCD_IMAGE_TAG=v3.4.1"
|
||||||
Environment="ETCD_NAME=${etcd_name}"
|
Environment="ETCD_NAME=${etcd_name}"
|
||||||
Environment="ETCD_ADVERTISE_CLIENT_URLS=https://${etcd_domain}:2379"
|
Environment="ETCD_ADVERTISE_CLIENT_URLS=https://${etcd_domain}:2379"
|
||||||
Environment="ETCD_INITIAL_ADVERTISE_PEER_URLS=https://${etcd_domain}:2380"
|
Environment="ETCD_INITIAL_ADVERTISE_PEER_URLS=https://${etcd_domain}:2380"
|
||||||
@ -63,11 +63,9 @@ systemd:
|
|||||||
--volume var-log,kind=host,source=/var/log \
|
--volume var-log,kind=host,source=/var/log \
|
||||||
--mount volume=var-log,target=/var/log \
|
--mount volume=var-log,target=/var/log \
|
||||||
--insecure-options=image"
|
--insecure-options=image"
|
||||||
ExecStartPre=/bin/mkdir -p /opt/cni/bin
|
|
||||||
ExecStartPre=/bin/mkdir -p /etc/kubernetes/manifests
|
ExecStartPre=/bin/mkdir -p /etc/kubernetes/manifests
|
||||||
ExecStartPre=/bin/mkdir -p /etc/kubernetes/cni/net.d
|
ExecStartPre=/bin/mkdir -p /etc/kubernetes/cni/net.d
|
||||||
ExecStartPre=/bin/mkdir -p /etc/kubernetes/checkpoint-secrets
|
ExecStartPre=/bin/mkdir -p /opt/cni/bin
|
||||||
ExecStartPre=/bin/mkdir -p /etc/kubernetes/inactive-manifests
|
|
||||||
ExecStartPre=/bin/mkdir -p /var/lib/cni
|
ExecStartPre=/bin/mkdir -p /var/lib/cni
|
||||||
ExecStartPre=/bin/mkdir -p /var/lib/calico
|
ExecStartPre=/bin/mkdir -p /var/lib/calico
|
||||||
ExecStartPre=/bin/mkdir -p /var/lib/kubelet/volumeplugins
|
ExecStartPre=/bin/mkdir -p /var/lib/kubelet/volumeplugins
|
||||||
@ -85,8 +83,8 @@ systemd:
|
|||||||
--kubeconfig=/etc/kubernetes/kubeconfig \
|
--kubeconfig=/etc/kubernetes/kubeconfig \
|
||||||
--lock-file=/var/run/lock/kubelet.lock \
|
--lock-file=/var/run/lock/kubelet.lock \
|
||||||
--network-plugin=cni \
|
--network-plugin=cni \
|
||||||
--node-labels=node-role.kubernetes.io/master \
|
--node-labels=node.kubernetes.io/master \
|
||||||
--node-labels=node-role.kubernetes.io/controller="true" \
|
--node-labels=node.kubernetes.io/controller="true" \
|
||||||
--pod-manifest-path=/etc/kubernetes/manifests \
|
--pod-manifest-path=/etc/kubernetes/manifests \
|
||||||
--read-only-port=0 \
|
--read-only-port=0 \
|
||||||
--register-with-taints=node-role.kubernetes.io/master=:NoSchedule \
|
--register-with-taints=node-role.kubernetes.io/master=:NoSchedule \
|
||||||
@ -96,17 +94,28 @@ systemd:
|
|||||||
RestartSec=10
|
RestartSec=10
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
- name: bootkube.service
|
- name: bootstrap.service
|
||||||
contents: |
|
contents: |
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Bootstrap a Kubernetes cluster
|
Description=Kubernetes control plane
|
||||||
ConditionPathExists=!/opt/bootkube/init_bootkube.done
|
ConditionPathExists=!/opt/bootstrap/bootstrap.done
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
RemainAfterExit=true
|
RemainAfterExit=true
|
||||||
WorkingDirectory=/opt/bootkube
|
WorkingDirectory=/opt/bootstrap
|
||||||
ExecStart=/opt/bootkube/bootkube-start
|
ExecStartPre=-/usr/bin/bash -c 'set -x && [ -n "$(ls /opt/bootstrap/assets/manifests-*/* 2>/dev/null)" ] && mv /opt/bootstrap/assets/manifests-*/* /opt/bootstrap/assets/manifests && rm -rf /opt/bootstrap/assets/manifests-*'
|
||||||
ExecStartPost=/bin/touch /opt/bootkube/init_bootkube.done
|
ExecStart=/usr/bin/rkt run \
|
||||||
|
--trust-keys-from-https \
|
||||||
|
--volume assets,kind=host,source=/opt/bootstrap/assets \
|
||||||
|
--mount volume=assets,target=/assets \
|
||||||
|
--volume script,kind=host,source=/opt/bootstrap/apply \
|
||||||
|
--mount volume=script,target=/apply \
|
||||||
|
--insecure-options=image \
|
||||||
|
docker://k8s.gcr.io/hyperkube:v1.16.1 \
|
||||||
|
--net=host \
|
||||||
|
--dns=host \
|
||||||
|
--exec=/apply
|
||||||
|
ExecStartPost=/bin/touch /opt/bootstrap/bootstrap.done
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
storage:
|
storage:
|
||||||
@ -123,37 +132,27 @@ storage:
|
|||||||
contents:
|
contents:
|
||||||
inline: |
|
inline: |
|
||||||
KUBELET_IMAGE_URL=docker://k8s.gcr.io/hyperkube
|
KUBELET_IMAGE_URL=docker://k8s.gcr.io/hyperkube
|
||||||
KUBELET_IMAGE_TAG=v1.15.1
|
KUBELET_IMAGE_TAG=v1.16.1
|
||||||
|
- path: /opt/bootstrap/apply
|
||||||
|
filesystem: root
|
||||||
|
mode: 0544
|
||||||
|
contents:
|
||||||
|
inline: |
|
||||||
|
#!/bin/bash -e
|
||||||
|
export KUBECONFIG=/assets/auth/kubeconfig
|
||||||
|
until kubectl version; do
|
||||||
|
echo "Waiting for static pod control plane"
|
||||||
|
sleep 5
|
||||||
|
done
|
||||||
|
until kubectl apply -f /assets/manifests -R; do
|
||||||
|
echo "Retry applying manifests"
|
||||||
|
sleep 5
|
||||||
|
done
|
||||||
- path: /etc/sysctl.d/max-user-watches.conf
|
- path: /etc/sysctl.d/max-user-watches.conf
|
||||||
filesystem: root
|
filesystem: root
|
||||||
contents:
|
contents:
|
||||||
inline: |
|
inline: |
|
||||||
fs.inotify.max_user_watches=16184
|
fs.inotify.max_user_watches=16184
|
||||||
- path: /opt/bootkube/bootkube-start
|
|
||||||
filesystem: root
|
|
||||||
mode: 0544
|
|
||||||
user:
|
|
||||||
id: 500
|
|
||||||
group:
|
|
||||||
id: 500
|
|
||||||
contents:
|
|
||||||
inline: |
|
|
||||||
#!/bin/bash
|
|
||||||
# Wrapper for bootkube start
|
|
||||||
set -e
|
|
||||||
# Move experimental manifests
|
|
||||||
[ -n "$(ls /opt/bootkube/assets/manifests-*/* 2>/dev/null)" ] && mv /opt/bootkube/assets/manifests-*/* /opt/bootkube/assets/manifests && rm -rf /opt/bootkube/assets/manifests-*
|
|
||||||
exec /usr/bin/rkt run \
|
|
||||||
--trust-keys-from-https \
|
|
||||||
--volume assets,kind=host,source=/opt/bootkube/assets \
|
|
||||||
--mount volume=assets,target=/assets \
|
|
||||||
--volume bootstrap,kind=host,source=/etc/kubernetes \
|
|
||||||
--mount volume=bootstrap,target=/etc/kubernetes \
|
|
||||||
$${RKT_OPTS} \
|
|
||||||
quay.io/coreos/bootkube:v0.14.0 \
|
|
||||||
--net=host \
|
|
||||||
--dns=host \
|
|
||||||
--exec=/bootkube -- start --asset-dir=/assets "$@"
|
|
||||||
passwd:
|
passwd:
|
||||||
users:
|
users:
|
||||||
- name: core
|
- name: core
|
||||||
|
@ -155,7 +155,7 @@ data "template_file" "controller-configs" {
|
|||||||
etcd_domain = "${var.cluster_name}-etcd${count.index}.${var.dns_zone}"
|
etcd_domain = "${var.cluster_name}-etcd${count.index}.${var.dns_zone}"
|
||||||
# etcd0=https://cluster-etcd0.example.com,etcd1=https://cluster-etcd1.example.com,...
|
# etcd0=https://cluster-etcd0.example.com,etcd1=https://cluster-etcd1.example.com,...
|
||||||
etcd_initial_cluster = join(",", data.template_file.etcds.*.rendered)
|
etcd_initial_cluster = join(",", data.template_file.etcds.*.rendered)
|
||||||
kubeconfig = indent(10, module.bootkube.kubeconfig-kubelet)
|
kubeconfig = indent(10, module.bootstrap.kubeconfig-kubelet)
|
||||||
ssh_authorized_key = var.ssh_authorized_key
|
ssh_authorized_key = var.ssh_authorized_key
|
||||||
cluster_dns_service_ip = cidrhost(var.service_cidr, 10)
|
cluster_dns_service_ip = cidrhost(var.service_cidr, 10)
|
||||||
cluster_domain_suffix = var.cluster_domain_suffix
|
cluster_domain_suffix = var.cluster_domain_suffix
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
output "kubeconfig-admin" {
|
output "kubeconfig-admin" {
|
||||||
value = module.bootkube.kubeconfig-admin
|
value = module.bootstrap.kubeconfig-admin
|
||||||
}
|
}
|
||||||
|
|
||||||
# Outputs for Kubernetes Ingress
|
# Outputs for Kubernetes Ingress
|
||||||
@ -28,7 +28,7 @@ output "security_group_id" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
output "kubeconfig" {
|
output "kubeconfig" {
|
||||||
value = module.bootkube.kubeconfig-kubelet
|
value = module.bootstrap.kubeconfig-kubelet
|
||||||
}
|
}
|
||||||
|
|
||||||
# Outputs for custom firewalling
|
# Outputs for custom firewalling
|
||||||
|
@ -53,6 +53,22 @@ resource "azurerm_network_security_rule" "controller-etcd-metrics" {
|
|||||||
destination_address_prefix = azurerm_subnet.controller.address_prefix
|
destination_address_prefix = azurerm_subnet.controller.address_prefix
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Allow Prometheus to scrape kube-scheduler and kube-controller-manager metrics
|
||||||
|
resource "azurerm_network_security_rule" "controller-kube-metrics" {
|
||||||
|
resource_group_name = azurerm_resource_group.cluster.name
|
||||||
|
|
||||||
|
name = "allow-kube-metrics"
|
||||||
|
network_security_group_name = azurerm_network_security_group.controller.name
|
||||||
|
priority = "2011"
|
||||||
|
access = "Allow"
|
||||||
|
direction = "Inbound"
|
||||||
|
protocol = "Tcp"
|
||||||
|
source_port_range = "*"
|
||||||
|
destination_port_range = "10251-10252"
|
||||||
|
source_address_prefix = azurerm_subnet.worker.address_prefix
|
||||||
|
destination_address_prefix = azurerm_subnet.controller.address_prefix
|
||||||
|
}
|
||||||
|
|
||||||
resource "azurerm_network_security_rule" "controller-apiserver" {
|
resource "azurerm_network_security_rule" "controller-apiserver" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
resource_group_name = azurerm_resource_group.cluster.name
|
||||||
|
|
||||||
|
@ -1,50 +1,58 @@
|
|||||||
# Secure copy etcd TLS assets to controllers.
|
# Secure copy assets to controllers.
|
||||||
resource "null_resource" "copy-controller-secrets" {
|
resource "null_resource" "copy-controller-secrets" {
|
||||||
count = var.controller_count
|
count = var.controller_count
|
||||||
|
|
||||||
depends_on = [azurerm_virtual_machine.controllers]
|
depends_on = [
|
||||||
|
module.bootstrap,
|
||||||
|
azurerm_virtual_machine.controllers
|
||||||
|
]
|
||||||
|
|
||||||
connection {
|
connection {
|
||||||
type = "ssh"
|
type = "ssh"
|
||||||
host = element(azurerm_public_ip.controllers.*.ip_address, count.index)
|
host = azurerm_public_ip.controllers.*.ip_address[count.index]
|
||||||
user = "core"
|
user = "core"
|
||||||
timeout = "15m"
|
timeout = "15m"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.etcd_ca_cert
|
content = module.bootstrap.etcd_ca_cert
|
||||||
destination = "$HOME/etcd-client-ca.crt"
|
destination = "$HOME/etcd-client-ca.crt"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.etcd_client_cert
|
content = module.bootstrap.etcd_client_cert
|
||||||
destination = "$HOME/etcd-client.crt"
|
destination = "$HOME/etcd-client.crt"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.etcd_client_key
|
content = module.bootstrap.etcd_client_key
|
||||||
destination = "$HOME/etcd-client.key"
|
destination = "$HOME/etcd-client.key"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.etcd_server_cert
|
content = module.bootstrap.etcd_server_cert
|
||||||
destination = "$HOME/etcd-server.crt"
|
destination = "$HOME/etcd-server.crt"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.etcd_server_key
|
content = module.bootstrap.etcd_server_key
|
||||||
destination = "$HOME/etcd-server.key"
|
destination = "$HOME/etcd-server.key"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.etcd_peer_cert
|
content = module.bootstrap.etcd_peer_cert
|
||||||
destination = "$HOME/etcd-peer.crt"
|
destination = "$HOME/etcd-peer.crt"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.etcd_peer_key
|
content = module.bootstrap.etcd_peer_key
|
||||||
destination = "$HOME/etcd-peer.key"
|
destination = "$HOME/etcd-peer.key"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
provisioner "file" {
|
||||||
|
source = var.asset_dir
|
||||||
|
destination = "$HOME/assets"
|
||||||
|
}
|
||||||
|
|
||||||
provisioner "remote-exec" {
|
provisioner "remote-exec" {
|
||||||
inline = [
|
inline = [
|
||||||
@ -58,18 +66,22 @@ resource "null_resource" "copy-controller-secrets" {
|
|||||||
"sudo mv etcd-peer.key /etc/ssl/etcd/etcd/peer.key",
|
"sudo mv etcd-peer.key /etc/ssl/etcd/etcd/peer.key",
|
||||||
"sudo chown -R etcd:etcd /etc/ssl/etcd",
|
"sudo chown -R etcd:etcd /etc/ssl/etcd",
|
||||||
"sudo chmod -R 500 /etc/ssl/etcd",
|
"sudo chmod -R 500 /etc/ssl/etcd",
|
||||||
|
"sudo mv $HOME/assets /opt/bootstrap/assets",
|
||||||
|
"sudo mkdir -p /etc/kubernetes/manifests",
|
||||||
|
"sudo mkdir -p /etc/kubernetes/bootstrap-secrets",
|
||||||
|
"sudo cp -r /opt/bootstrap/assets/tls/* /etc/kubernetes/bootstrap-secrets/",
|
||||||
|
"sudo cp /opt/bootstrap/assets/auth/kubeconfig /etc/kubernetes/bootstrap-secrets/",
|
||||||
|
"sudo cp -r /opt/bootstrap/assets/static-manifests/* /etc/kubernetes/manifests/",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Secure copy bootkube assets to ONE controller and start bootkube to perform
|
# Connect to a controller to perform one-time cluster bootstrap.
|
||||||
# one-time self-hosted cluster bootstrapping.
|
resource "null_resource" "bootstrap" {
|
||||||
resource "null_resource" "bootkube-start" {
|
|
||||||
depends_on = [
|
depends_on = [
|
||||||
module.bootkube,
|
null_resource.copy-controller-secrets,
|
||||||
module.workers,
|
module.workers,
|
||||||
azurerm_dns_a_record.apiserver,
|
azurerm_dns_a_record.apiserver,
|
||||||
null_resource.copy-controller-secrets,
|
|
||||||
]
|
]
|
||||||
|
|
||||||
connection {
|
connection {
|
||||||
@ -79,15 +91,9 @@ resource "null_resource" "bootkube-start" {
|
|||||||
timeout = "15m"
|
timeout = "15m"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
|
||||||
source = var.asset_dir
|
|
||||||
destination = "$HOME/assets"
|
|
||||||
}
|
|
||||||
|
|
||||||
provisioner "remote-exec" {
|
provisioner "remote-exec" {
|
||||||
inline = [
|
inline = [
|
||||||
"sudo mv $HOME/assets /opt/bootkube",
|
"sudo systemctl start bootstrap",
|
||||||
"sudo systemctl start bootkube",
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,27 +23,27 @@ variable "dns_zone_group" {
|
|||||||
# instances
|
# instances
|
||||||
|
|
||||||
variable "controller_count" {
|
variable "controller_count" {
|
||||||
type = string
|
type = number
|
||||||
default = "1"
|
|
||||||
description = "Number of controllers (i.e. masters)"
|
description = "Number of controllers (i.e. masters)"
|
||||||
|
default = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "worker_count" {
|
variable "worker_count" {
|
||||||
type = string
|
type = number
|
||||||
default = "1"
|
|
||||||
description = "Number of workers"
|
description = "Number of workers"
|
||||||
|
default = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "controller_type" {
|
variable "controller_type" {
|
||||||
type = string
|
type = string
|
||||||
default = "Standard_DS1_v2"
|
|
||||||
description = "Machine type for controllers (see `az vm list-skus --location centralus`)"
|
description = "Machine type for controllers (see `az vm list-skus --location centralus`)"
|
||||||
|
default = "Standard_B2s"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "worker_type" {
|
variable "worker_type" {
|
||||||
type = string
|
type = string
|
||||||
default = "Standard_F1"
|
|
||||||
description = "Machine type for workers (see `az vm list-skus --location centralus`)"
|
description = "Machine type for workers (see `az vm list-skus --location centralus`)"
|
||||||
|
default = "Standard_DS1_v2"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "os_image" {
|
variable "os_image" {
|
||||||
@ -53,15 +53,15 @@ variable "os_image" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
variable "disk_size" {
|
variable "disk_size" {
|
||||||
type = string
|
type = number
|
||||||
default = "40"
|
|
||||||
description = "Size of the disk in GB"
|
description = "Size of the disk in GB"
|
||||||
|
default = 40
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "worker_priority" {
|
variable "worker_priority" {
|
||||||
type = string
|
type = string
|
||||||
default = "Regular"
|
|
||||||
description = "Set worker priority to Low to use reduced cost surplus capacity, with the tradeoff that instances can be deallocated at any time."
|
description = "Set worker priority to Low to use reduced cost surplus capacity, with the tradeoff that instances can be deallocated at any time."
|
||||||
|
default = "Regular"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "controller_clc_snippets" {
|
variable "controller_clc_snippets" {
|
||||||
@ -84,54 +84,60 @@ variable "ssh_authorized_key" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
variable "asset_dir" {
|
variable "asset_dir" {
|
||||||
description = "Path to a directory where generated assets should be placed (contains secrets)"
|
|
||||||
type = string
|
type = string
|
||||||
|
description = "Absolute path to a directory where generated assets should be placed (contains secrets)"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "networking" {
|
variable "networking" {
|
||||||
description = "Choice of networking provider (flannel or calico)"
|
|
||||||
type = string
|
type = string
|
||||||
|
description = "Choice of networking provider (flannel or calico)"
|
||||||
default = "flannel"
|
default = "flannel"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "host_cidr" {
|
variable "host_cidr" {
|
||||||
description = "CIDR IPv4 range to assign to instances"
|
|
||||||
type = string
|
type = string
|
||||||
|
description = "CIDR IPv4 range to assign to instances"
|
||||||
default = "10.0.0.0/16"
|
default = "10.0.0.0/16"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "pod_cidr" {
|
variable "pod_cidr" {
|
||||||
description = "CIDR IPv4 range to assign Kubernetes pods"
|
|
||||||
type = string
|
type = string
|
||||||
|
description = "CIDR IPv4 range to assign Kubernetes pods"
|
||||||
default = "10.2.0.0/16"
|
default = "10.2.0.0/16"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "service_cidr" {
|
variable "service_cidr" {
|
||||||
|
type = string
|
||||||
description = <<EOD
|
description = <<EOD
|
||||||
CIDR IPv4 range to assign Kubernetes services.
|
CIDR IPv4 range to assign Kubernetes services.
|
||||||
The 1st IP will be reserved for kube_apiserver, the 10th IP will be reserved for coredns.
|
The 1st IP will be reserved for kube_apiserver, the 10th IP will be reserved for coredns.
|
||||||
EOD
|
EOD
|
||||||
|
|
||||||
|
|
||||||
type = string
|
|
||||||
default = "10.3.0.0/16"
|
default = "10.3.0.0/16"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "cluster_domain_suffix" {
|
|
||||||
description = "Queries for domains with the suffix will be answered by coredns. Default is cluster.local (e.g. foo.default.svc.cluster.local) "
|
|
||||||
type = string
|
|
||||||
default = "cluster.local"
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "enable_reporting" {
|
variable "enable_reporting" {
|
||||||
type = string
|
type = bool
|
||||||
description = "Enable usage or analytics reporting to upstreams (Calico)"
|
description = "Enable usage or analytics reporting to upstreams (Calico)"
|
||||||
default = "false"
|
default = false
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "enable_aggregation" {
|
variable "enable_aggregation" {
|
||||||
|
type = bool
|
||||||
description = "Enable the Kubernetes Aggregation Layer (defaults to false)"
|
description = "Enable the Kubernetes Aggregation Layer (defaults to false)"
|
||||||
type = string
|
default = false
|
||||||
default = "false"
|
}
|
||||||
|
|
||||||
|
variable "worker_node_labels" {
|
||||||
|
type = list(string)
|
||||||
|
description = "List of initial worker node labels"
|
||||||
|
default = []
|
||||||
|
}
|
||||||
|
|
||||||
|
# unofficial, undocumented, unsupported
|
||||||
|
|
||||||
|
variable "cluster_domain_suffix" {
|
||||||
|
type = string
|
||||||
|
description = "Queries for domains with the suffix will be answered by coredns. Default is cluster.local (e.g. foo.default.svc.cluster.local) "
|
||||||
|
default = "cluster.local"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,10 +15,11 @@ module "workers" {
|
|||||||
priority = var.worker_priority
|
priority = var.worker_priority
|
||||||
|
|
||||||
# configuration
|
# configuration
|
||||||
kubeconfig = module.bootkube.kubeconfig-kubelet
|
kubeconfig = module.bootstrap.kubeconfig-kubelet
|
||||||
ssh_authorized_key = var.ssh_authorized_key
|
ssh_authorized_key = var.ssh_authorized_key
|
||||||
service_cidr = var.service_cidr
|
service_cidr = var.service_cidr
|
||||||
cluster_domain_suffix = var.cluster_domain_suffix
|
cluster_domain_suffix = var.cluster_domain_suffix
|
||||||
clc_snippets = var.worker_clc_snippets
|
clc_snippets = var.worker_clc_snippets
|
||||||
|
node_labels = var.worker_node_labels
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,9 +38,9 @@ systemd:
|
|||||||
--volume var-log,kind=host,source=/var/log \
|
--volume var-log,kind=host,source=/var/log \
|
||||||
--mount volume=var-log,target=/var/log \
|
--mount volume=var-log,target=/var/log \
|
||||||
--insecure-options=image"
|
--insecure-options=image"
|
||||||
ExecStartPre=/bin/mkdir -p /opt/cni/bin
|
|
||||||
ExecStartPre=/bin/mkdir -p /etc/kubernetes/manifests
|
ExecStartPre=/bin/mkdir -p /etc/kubernetes/manifests
|
||||||
ExecStartPre=/bin/mkdir -p /etc/kubernetes/cni/net.d
|
ExecStartPre=/bin/mkdir -p /etc/kubernetes/cni/net.d
|
||||||
|
ExecStartPre=/bin/mkdir -p /opt/cni/bin
|
||||||
ExecStartPre=/bin/mkdir -p /var/lib/cni
|
ExecStartPre=/bin/mkdir -p /var/lib/cni
|
||||||
ExecStartPre=/bin/mkdir -p /var/lib/calico
|
ExecStartPre=/bin/mkdir -p /var/lib/calico
|
||||||
ExecStartPre=/bin/mkdir -p /var/lib/kubelet/volumeplugins
|
ExecStartPre=/bin/mkdir -p /var/lib/kubelet/volumeplugins
|
||||||
@ -58,7 +58,10 @@ systemd:
|
|||||||
--kubeconfig=/etc/kubernetes/kubeconfig \
|
--kubeconfig=/etc/kubernetes/kubeconfig \
|
||||||
--lock-file=/var/run/lock/kubelet.lock \
|
--lock-file=/var/run/lock/kubelet.lock \
|
||||||
--network-plugin=cni \
|
--network-plugin=cni \
|
||||||
--node-labels=node-role.kubernetes.io/node \
|
--node-labels=node.kubernetes.io/node \
|
||||||
|
%{ for label in split(",", node_labels) }
|
||||||
|
--node-labels=${label} \
|
||||||
|
%{ endfor ~}
|
||||||
--pod-manifest-path=/etc/kubernetes/manifests \
|
--pod-manifest-path=/etc/kubernetes/manifests \
|
||||||
--read-only-port=0 \
|
--read-only-port=0 \
|
||||||
--volume-plugin-dir=/var/lib/kubelet/volumeplugins
|
--volume-plugin-dir=/var/lib/kubelet/volumeplugins
|
||||||
@ -93,7 +96,7 @@ storage:
|
|||||||
contents:
|
contents:
|
||||||
inline: |
|
inline: |
|
||||||
KUBELET_IMAGE_URL=docker://k8s.gcr.io/hyperkube
|
KUBELET_IMAGE_URL=docker://k8s.gcr.io/hyperkube
|
||||||
KUBELET_IMAGE_TAG=v1.15.1
|
KUBELET_IMAGE_TAG=v1.16.1
|
||||||
- path: /etc/sysctl.d/max-user-watches.conf
|
- path: /etc/sysctl.d/max-user-watches.conf
|
||||||
filesystem: root
|
filesystem: root
|
||||||
contents:
|
contents:
|
||||||
@ -111,7 +114,7 @@ storage:
|
|||||||
--volume config,kind=host,source=/etc/kubernetes \
|
--volume config,kind=host,source=/etc/kubernetes \
|
||||||
--mount volume=config,target=/etc/kubernetes \
|
--mount volume=config,target=/etc/kubernetes \
|
||||||
--insecure-options=image \
|
--insecure-options=image \
|
||||||
docker://k8s.gcr.io/hyperkube:v1.15.1 \
|
docker://k8s.gcr.io/hyperkube:v1.16.1 \
|
||||||
--net=host \
|
--net=host \
|
||||||
--dns=host \
|
--dns=host \
|
||||||
--exec=/kubectl -- --kubeconfig=/etc/kubernetes/kubeconfig delete node $(hostname | tr '[:upper:]' '[:lower:]')
|
--exec=/kubectl -- --kubeconfig=/etc/kubernetes/kubeconfig delete node $(hostname | tr '[:upper:]' '[:lower:]')
|
||||||
|
@ -33,27 +33,27 @@ variable "backend_address_pool_id" {
|
|||||||
# instances
|
# instances
|
||||||
|
|
||||||
variable "worker_count" {
|
variable "worker_count" {
|
||||||
type = string
|
type = number
|
||||||
default = "1"
|
|
||||||
description = "Number of instances"
|
description = "Number of instances"
|
||||||
|
default = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "vm_type" {
|
variable "vm_type" {
|
||||||
type = string
|
type = string
|
||||||
default = "Standard_F1"
|
|
||||||
description = "Machine type for instances (see `az vm list-skus --location centralus`)"
|
description = "Machine type for instances (see `az vm list-skus --location centralus`)"
|
||||||
|
default = "Standard_DS1_v2"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "os_image" {
|
variable "os_image" {
|
||||||
type = string
|
type = string
|
||||||
default = "coreos-stable"
|
|
||||||
description = "Channel for a Container Linux derivative (coreos-stable, coreos-beta, coreos-alpha)"
|
description = "Channel for a Container Linux derivative (coreos-stable, coreos-beta, coreos-alpha)"
|
||||||
|
default = "coreos-stable"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "priority" {
|
variable "priority" {
|
||||||
type = string
|
type = string
|
||||||
default = "Regular"
|
|
||||||
description = "Set priority to Low to use reduced cost surplus capacity, with the tradeoff that instances can be evicted at any time."
|
description = "Set priority to Low to use reduced cost surplus capacity, with the tradeoff that instances can be evicted at any time."
|
||||||
|
default = "Regular"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "clc_snippets" {
|
variable "clc_snippets" {
|
||||||
@ -75,16 +75,22 @@ variable "ssh_authorized_key" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
variable "service_cidr" {
|
variable "service_cidr" {
|
||||||
|
type = string
|
||||||
description = <<EOD
|
description = <<EOD
|
||||||
CIDR IPv4 range to assign Kubernetes services.
|
CIDR IPv4 range to assign Kubernetes services.
|
||||||
The 1st IP will be reserved for kube_apiserver, the 10th IP will be reserved for coredns.
|
The 1st IP will be reserved for kube_apiserver, the 10th IP will be reserved for coredns.
|
||||||
EOD
|
EOD
|
||||||
|
|
||||||
|
|
||||||
type = string
|
|
||||||
default = "10.3.0.0/16"
|
default = "10.3.0.0/16"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "node_labels" {
|
||||||
|
type = list(string)
|
||||||
|
description = "List of initial node labels"
|
||||||
|
default = []
|
||||||
|
}
|
||||||
|
|
||||||
|
# unofficial, undocumented, unsupported
|
||||||
|
|
||||||
variable "cluster_domain_suffix" {
|
variable "cluster_domain_suffix" {
|
||||||
description = "Queries for domains with the suffix will be answered by coredns. Default is cluster.local (e.g. foo.default.svc.cluster.local) "
|
description = "Queries for domains with the suffix will be answered by coredns. Default is cluster.local (e.g. foo.default.svc.cluster.local) "
|
||||||
type = string
|
type = string
|
||||||
|
@ -111,6 +111,7 @@ data "template_file" "worker-config" {
|
|||||||
ssh_authorized_key = var.ssh_authorized_key
|
ssh_authorized_key = var.ssh_authorized_key
|
||||||
cluster_dns_service_ip = cidrhost(var.service_cidr, 10)
|
cluster_dns_service_ip = cidrhost(var.service_cidr, 10)
|
||||||
cluster_domain_suffix = var.cluster_domain_suffix
|
cluster_domain_suffix = var.cluster_domain_suffix
|
||||||
|
node_labels = join(",", var.node_labels)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ Typhoon distributes upstream Kubernetes, architectural conventions, and cluster
|
|||||||
|
|
||||||
## Features <a href="https://www.cncf.io/certification/software-conformance/"><img align="right" src="https://storage.googleapis.com/poseidon/certified-kubernetes.png"></a>
|
## Features <a href="https://www.cncf.io/certification/software-conformance/"><img align="right" src="https://storage.googleapis.com/poseidon/certified-kubernetes.png"></a>
|
||||||
|
|
||||||
* Kubernetes v1.15.1 (upstream, via [kubernetes-incubator/bootkube](https://github.com/kubernetes-incubator/bootkube))
|
* Kubernetes v1.16.1 (upstream)
|
||||||
* Single or multi-master, [Calico](https://www.projectcalico.org/) or [flannel](https://github.com/coreos/flannel) networking
|
* Single or multi-master, [Calico](https://www.projectcalico.org/) or [flannel](https://github.com/coreos/flannel) networking
|
||||||
* On-cluster etcd with TLS, [RBAC](https://kubernetes.io/docs/admin/authorization/rbac/)-enabled, [network policy](https://kubernetes.io/docs/concepts/services-networking/network-policies/)
|
* On-cluster etcd with TLS, [RBAC](https://kubernetes.io/docs/admin/authorization/rbac/)-enabled, [network policy](https://kubernetes.io/docs/concepts/services-networking/network-policies/)
|
||||||
* Advanced features like [snippets](https://typhoon.psdn.io/advanced/customization/#container-linux) customization
|
* Advanced features like [snippets](https://typhoon.psdn.io/advanced/customization/#container-linux) customization
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Self-hosted Kubernetes assets (kubeconfig, manifests)
|
# Kubernetes assets (kubeconfig, manifests)
|
||||||
module "bootkube" {
|
module "bootstrap" {
|
||||||
source = "git::https://github.com/poseidon/terraform-render-bootkube.git?ref=5b9faa903182505ac534f42a2cf250d5d215941b"
|
source = "git::https://github.com/poseidon/terraform-render-bootstrap.git?ref=586d6e36f67c56fb2283f317a7552638368c5779"
|
||||||
|
|
||||||
cluster_name = var.cluster_name
|
cluster_name = var.cluster_name
|
||||||
api_servers = [var.k8s_domain_name]
|
api_servers = [var.k8s_domain_name]
|
@ -7,7 +7,7 @@ systemd:
|
|||||||
- name: 40-etcd-cluster.conf
|
- name: 40-etcd-cluster.conf
|
||||||
contents: |
|
contents: |
|
||||||
[Service]
|
[Service]
|
||||||
Environment="ETCD_IMAGE_TAG=v3.3.13"
|
Environment="ETCD_IMAGE_TAG=v3.4.1"
|
||||||
Environment="ETCD_NAME=${etcd_name}"
|
Environment="ETCD_NAME=${etcd_name}"
|
||||||
Environment="ETCD_ADVERTISE_CLIENT_URLS=https://${domain_name}:2379"
|
Environment="ETCD_ADVERTISE_CLIENT_URLS=https://${domain_name}:2379"
|
||||||
Environment="ETCD_INITIAL_ADVERTISE_PEER_URLS=https://${domain_name}:2380"
|
Environment="ETCD_INITIAL_ADVERTISE_PEER_URLS=https://${domain_name}:2380"
|
||||||
@ -76,11 +76,9 @@ systemd:
|
|||||||
--mount volume=iscsiadm,target=/sbin/iscsiadm \
|
--mount volume=iscsiadm,target=/sbin/iscsiadm \
|
||||||
--insecure-options=image"
|
--insecure-options=image"
|
||||||
Environment=KUBELET_CGROUP_DRIVER=${cgroup_driver}
|
Environment=KUBELET_CGROUP_DRIVER=${cgroup_driver}
|
||||||
ExecStartPre=/bin/mkdir -p /opt/cni/bin
|
|
||||||
ExecStartPre=/bin/mkdir -p /etc/kubernetes/manifests
|
|
||||||
ExecStartPre=/bin/mkdir -p /etc/kubernetes/cni/net.d
|
ExecStartPre=/bin/mkdir -p /etc/kubernetes/cni/net.d
|
||||||
ExecStartPre=/bin/mkdir -p /etc/kubernetes/checkpoint-secrets
|
ExecStartPre=/bin/mkdir -p /etc/kubernetes/manifests
|
||||||
ExecStartPre=/bin/mkdir -p /etc/kubernetes/inactive-manifests
|
ExecStartPre=/bin/mkdir -p /opt/cni/bin
|
||||||
ExecStartPre=/bin/mkdir -p /var/lib/cni
|
ExecStartPre=/bin/mkdir -p /var/lib/cni
|
||||||
ExecStartPre=/bin/mkdir -p /var/lib/calico
|
ExecStartPre=/bin/mkdir -p /var/lib/calico
|
||||||
ExecStartPre=/bin/mkdir -p /var/lib/kubelet/volumeplugins
|
ExecStartPre=/bin/mkdir -p /var/lib/kubelet/volumeplugins
|
||||||
@ -100,8 +98,8 @@ systemd:
|
|||||||
--kubeconfig=/etc/kubernetes/kubeconfig \
|
--kubeconfig=/etc/kubernetes/kubeconfig \
|
||||||
--lock-file=/var/run/lock/kubelet.lock \
|
--lock-file=/var/run/lock/kubelet.lock \
|
||||||
--network-plugin=cni \
|
--network-plugin=cni \
|
||||||
--node-labels=node-role.kubernetes.io/master \
|
--node-labels=node.kubernetes.io/master \
|
||||||
--node-labels=node-role.kubernetes.io/controller="true" \
|
--node-labels=node.kubernetes.io/controller="true" \
|
||||||
--pod-manifest-path=/etc/kubernetes/manifests \
|
--pod-manifest-path=/etc/kubernetes/manifests \
|
||||||
--read-only-port=0 \
|
--read-only-port=0 \
|
||||||
--register-with-taints=node-role.kubernetes.io/master=:NoSchedule \
|
--register-with-taints=node-role.kubernetes.io/master=:NoSchedule \
|
||||||
@ -111,17 +109,30 @@ systemd:
|
|||||||
RestartSec=10
|
RestartSec=10
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
- name: bootkube.service
|
- name: bootstrap.service
|
||||||
contents: |
|
contents: |
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Bootstrap a Kubernetes control plane with a temp api-server
|
Description=Kubernetes control plane
|
||||||
ConditionPathExists=!/opt/bootkube/init_bootkube.done
|
ConditionPathExists=!/opt/bootstrap/bootstrap.done
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
RemainAfterExit=true
|
RemainAfterExit=true
|
||||||
WorkingDirectory=/opt/bootkube
|
WorkingDirectory=/opt/bootstrap
|
||||||
ExecStart=/opt/bootkube/bootkube-start
|
ExecStartPre=-/usr/bin/bash -c 'set -x && [ -n "$(ls /opt/bootstrap/assets/manifests-*/* 2>/dev/null)" ] && mv /opt/bootstrap/assets/manifests-*/* /opt/bootstrap/assets/manifests && rm -rf /opt/bootstrap/assets/manifests-*'
|
||||||
ExecStartPost=/bin/touch /opt/bootkube/init_bootkube.done
|
ExecStart=/usr/bin/rkt run \
|
||||||
|
--trust-keys-from-https \
|
||||||
|
--volume assets,kind=host,source=/opt/bootstrap/assets \
|
||||||
|
--mount volume=assets,target=/assets \
|
||||||
|
--volume script,kind=host,source=/opt/bootstrap/apply \
|
||||||
|
--mount volume=script,target=/apply \
|
||||||
|
--insecure-options=image \
|
||||||
|
docker://k8s.gcr.io/hyperkube:v1.16.1 \
|
||||||
|
--net=host \
|
||||||
|
--dns=host \
|
||||||
|
--exec=/apply
|
||||||
|
ExecStartPost=/bin/touch /opt/bootstrap/bootstrap.done
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
storage:
|
storage:
|
||||||
files:
|
files:
|
||||||
- path: /etc/kubernetes/kubelet.env
|
- path: /etc/kubernetes/kubelet.env
|
||||||
@ -130,43 +141,33 @@ storage:
|
|||||||
contents:
|
contents:
|
||||||
inline: |
|
inline: |
|
||||||
KUBELET_IMAGE_URL=docker://k8s.gcr.io/hyperkube
|
KUBELET_IMAGE_URL=docker://k8s.gcr.io/hyperkube
|
||||||
KUBELET_IMAGE_TAG=v1.15.1
|
KUBELET_IMAGE_TAG=v1.16.1
|
||||||
- path: /etc/hostname
|
- path: /etc/hostname
|
||||||
filesystem: root
|
filesystem: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
contents:
|
contents:
|
||||||
inline:
|
inline:
|
||||||
${domain_name}
|
${domain_name}
|
||||||
|
- path: /opt/bootstrap/apply
|
||||||
|
filesystem: root
|
||||||
|
mode: 0544
|
||||||
|
contents:
|
||||||
|
inline: |
|
||||||
|
#!/bin/bash -e
|
||||||
|
export KUBECONFIG=/assets/auth/kubeconfig
|
||||||
|
until kubectl version; do
|
||||||
|
echo "Waiting for static pod control plane"
|
||||||
|
sleep 5
|
||||||
|
done
|
||||||
|
until kubectl apply -f /assets/manifests -R; do
|
||||||
|
echo "Retry applying manifests"
|
||||||
|
sleep 5
|
||||||
|
done
|
||||||
- path: /etc/sysctl.d/max-user-watches.conf
|
- path: /etc/sysctl.d/max-user-watches.conf
|
||||||
filesystem: root
|
filesystem: root
|
||||||
contents:
|
contents:
|
||||||
inline: |
|
inline: |
|
||||||
fs.inotify.max_user_watches=16184
|
fs.inotify.max_user_watches=16184
|
||||||
- path: /opt/bootkube/bootkube-start
|
|
||||||
filesystem: root
|
|
||||||
mode: 0544
|
|
||||||
user:
|
|
||||||
id: 500
|
|
||||||
group:
|
|
||||||
id: 500
|
|
||||||
contents:
|
|
||||||
inline: |
|
|
||||||
#!/bin/bash
|
|
||||||
# Wrapper for bootkube start
|
|
||||||
set -e
|
|
||||||
# Move experimental manifests
|
|
||||||
[ -n "$(ls /opt/bootkube/assets/manifests-*/* 2>/dev/null)" ] && mv /opt/bootkube/assets/manifests-*/* /opt/bootkube/assets/manifests && rm -rf /opt/bootkube/assets/manifests-*
|
|
||||||
exec /usr/bin/rkt run \
|
|
||||||
--trust-keys-from-https \
|
|
||||||
--volume assets,kind=host,source=/opt/bootkube/assets \
|
|
||||||
--mount volume=assets,target=/assets \
|
|
||||||
--volume bootstrap,kind=host,source=/etc/kubernetes \
|
|
||||||
--mount volume=bootstrap,target=/etc/kubernetes \
|
|
||||||
$${RKT_OPTS} \
|
|
||||||
quay.io/coreos/bootkube:v0.14.0 \
|
|
||||||
--net=host \
|
|
||||||
--dns=host \
|
|
||||||
--exec=/bootkube -- start --asset-dir=/assets "$@"
|
|
||||||
passwd:
|
passwd:
|
||||||
users:
|
users:
|
||||||
- name: core
|
- name: core
|
||||||
|
@ -35,7 +35,6 @@ storage:
|
|||||||
-d ${install_disk} \
|
-d ${install_disk} \
|
||||||
-C ${os_channel} \
|
-C ${os_channel} \
|
||||||
-V ${os_version} \
|
-V ${os_version} \
|
||||||
-o "${container_linux_oem}" \
|
|
||||||
${baseurl_flag} \
|
${baseurl_flag} \
|
||||||
-i ignition.json
|
-i ignition.json
|
||||||
udevadm settle
|
udevadm settle
|
||||||
|
@ -51,9 +51,9 @@ systemd:
|
|||||||
--mount volume=iscsiadm,target=/sbin/iscsiadm \
|
--mount volume=iscsiadm,target=/sbin/iscsiadm \
|
||||||
--insecure-options=image"
|
--insecure-options=image"
|
||||||
Environment=KUBELET_CGROUP_DRIVER=${cgroup_driver}
|
Environment=KUBELET_CGROUP_DRIVER=${cgroup_driver}
|
||||||
ExecStartPre=/bin/mkdir -p /opt/cni/bin
|
|
||||||
ExecStartPre=/bin/mkdir -p /etc/kubernetes/manifests
|
|
||||||
ExecStartPre=/bin/mkdir -p /etc/kubernetes/cni/net.d
|
ExecStartPre=/bin/mkdir -p /etc/kubernetes/cni/net.d
|
||||||
|
ExecStartPre=/bin/mkdir -p /etc/kubernetes/manifests
|
||||||
|
ExecStartPre=/bin/mkdir -p /opt/cni/bin
|
||||||
ExecStartPre=/bin/mkdir -p /var/lib/cni
|
ExecStartPre=/bin/mkdir -p /var/lib/cni
|
||||||
ExecStartPre=/bin/mkdir -p /var/lib/calico
|
ExecStartPre=/bin/mkdir -p /var/lib/calico
|
||||||
ExecStartPre=/bin/mkdir -p /var/lib/kubelet/volumeplugins
|
ExecStartPre=/bin/mkdir -p /var/lib/kubelet/volumeplugins
|
||||||
@ -73,7 +73,7 @@ systemd:
|
|||||||
--kubeconfig=/etc/kubernetes/kubeconfig \
|
--kubeconfig=/etc/kubernetes/kubeconfig \
|
||||||
--lock-file=/var/run/lock/kubelet.lock \
|
--lock-file=/var/run/lock/kubelet.lock \
|
||||||
--network-plugin=cni \
|
--network-plugin=cni \
|
||||||
--node-labels=node-role.kubernetes.io/node \
|
--node-labels=node.kubernetes.io/node \
|
||||||
--pod-manifest-path=/etc/kubernetes/manifests \
|
--pod-manifest-path=/etc/kubernetes/manifests \
|
||||||
--read-only-port=0 \
|
--read-only-port=0 \
|
||||||
--volume-plugin-dir=/var/lib/kubelet/volumeplugins
|
--volume-plugin-dir=/var/lib/kubelet/volumeplugins
|
||||||
@ -91,7 +91,7 @@ storage:
|
|||||||
contents:
|
contents:
|
||||||
inline: |
|
inline: |
|
||||||
KUBELET_IMAGE_URL=docker://k8s.gcr.io/hyperkube
|
KUBELET_IMAGE_URL=docker://k8s.gcr.io/hyperkube
|
||||||
KUBELET_IMAGE_TAG=v1.15.1
|
KUBELET_IMAGE_TAG=v1.16.1
|
||||||
- path: /etc/hostname
|
- path: /etc/hostname
|
||||||
filesystem: root
|
filesystem: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
|
@ -4,7 +4,7 @@ resource "matchbox_group" "install" {
|
|||||||
name = format("install-%s", element(concat(var.controller_names, var.worker_names), count.index))
|
name = format("install-%s", element(concat(var.controller_names, var.worker_names), count.index))
|
||||||
|
|
||||||
# pick one of 4 Matchbox profiles (Container Linux or Flatcar, cached or non-cached)
|
# pick one of 4 Matchbox profiles (Container Linux or Flatcar, cached or non-cached)
|
||||||
profile = local.flavor == "flatcar" ? var.cached_install == "true" ? element(matchbox_profile.cached-flatcar-linux-install.*.name, count.index) : element(matchbox_profile.flatcar-install.*.name, count.index) : var.cached_install == "true" ? element(matchbox_profile.cached-container-linux-install.*.name, count.index) : element(matchbox_profile.container-linux-install.*.name, count.index)
|
profile = local.flavor == "flatcar" ? var.cached_install ? element(matchbox_profile.cached-flatcar-linux-install.*.name, count.index) : element(matchbox_profile.flatcar-install.*.name, count.index) : var.cached_install ? element(matchbox_profile.cached-container-linux-install.*.name, count.index) : element(matchbox_profile.container-linux-install.*.name, count.index)
|
||||||
|
|
||||||
selector = {
|
selector = {
|
||||||
mac = element(concat(var.controller_macs, var.worker_macs), count.index)
|
mac = element(concat(var.controller_macs, var.worker_macs), count.index)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
output "kubeconfig-admin" {
|
output "kubeconfig-admin" {
|
||||||
value = module.bootkube.kubeconfig-admin
|
value = module.bootstrap.kubeconfig-admin
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,6 @@ data "template_file" "container-linux-install-configs" {
|
|||||||
os_version = var.os_version
|
os_version = var.os_version
|
||||||
ignition_endpoint = format("%s/ignition", var.matchbox_http_endpoint)
|
ignition_endpoint = format("%s/ignition", var.matchbox_http_endpoint)
|
||||||
install_disk = var.install_disk
|
install_disk = var.install_disk
|
||||||
container_linux_oem = var.container_linux_oem
|
|
||||||
ssh_authorized_key = var.ssh_authorized_key
|
ssh_authorized_key = var.ssh_authorized_key
|
||||||
# only cached-container-linux profile adds -b baseurl
|
# only cached-container-linux profile adds -b baseurl
|
||||||
baseurl_flag = ""
|
baseurl_flag = ""
|
||||||
@ -82,7 +81,6 @@ data "template_file" "cached-container-linux-install-configs" {
|
|||||||
os_version = var.os_version
|
os_version = var.os_version
|
||||||
ignition_endpoint = format("%s/ignition", var.matchbox_http_endpoint)
|
ignition_endpoint = format("%s/ignition", var.matchbox_http_endpoint)
|
||||||
install_disk = var.install_disk
|
install_disk = var.install_disk
|
||||||
container_linux_oem = var.container_linux_oem
|
|
||||||
ssh_authorized_key = var.ssh_authorized_key
|
ssh_authorized_key = var.ssh_authorized_key
|
||||||
# profile uses -b baseurl to install from matchbox cache
|
# profile uses -b baseurl to install from matchbox cache
|
||||||
baseurl_flag = "-b ${var.matchbox_http_endpoint}/assets/${local.flavor}"
|
baseurl_flag = "-b ${var.matchbox_http_endpoint}/assets/${local.flavor}"
|
||||||
@ -160,7 +158,7 @@ data "template_file" "controller-configs" {
|
|||||||
etcd_name = element(var.controller_names, count.index)
|
etcd_name = element(var.controller_names, count.index)
|
||||||
etcd_initial_cluster = join(",", formatlist("%s=https://%s:2380", var.controller_names, var.controller_domains))
|
etcd_initial_cluster = join(",", formatlist("%s=https://%s:2380", var.controller_names, var.controller_domains))
|
||||||
cgroup_driver = var.os_channel == "flatcar-edge" ? "systemd" : "cgroupfs"
|
cgroup_driver = var.os_channel == "flatcar-edge" ? "systemd" : "cgroupfs"
|
||||||
cluster_dns_service_ip = module.bootkube.cluster_dns_service_ip
|
cluster_dns_service_ip = module.bootstrap.cluster_dns_service_ip
|
||||||
cluster_domain_suffix = var.cluster_domain_suffix
|
cluster_domain_suffix = var.cluster_domain_suffix
|
||||||
ssh_authorized_key = var.ssh_authorized_key
|
ssh_authorized_key = var.ssh_authorized_key
|
||||||
}
|
}
|
||||||
@ -188,7 +186,7 @@ data "template_file" "worker-configs" {
|
|||||||
vars = {
|
vars = {
|
||||||
domain_name = element(var.worker_domains, count.index)
|
domain_name = element(var.worker_domains, count.index)
|
||||||
cgroup_driver = var.os_channel == "flatcar-edge" ? "systemd" : "cgroupfs"
|
cgroup_driver = var.os_channel == "flatcar-edge" ? "systemd" : "cgroupfs"
|
||||||
cluster_dns_service_ip = module.bootkube.cluster_dns_service_ip
|
cluster_dns_service_ip = module.bootstrap.cluster_dns_service_ip
|
||||||
cluster_domain_suffix = var.cluster_domain_suffix
|
cluster_domain_suffix = var.cluster_domain_suffix
|
||||||
ssh_authorized_key = var.ssh_authorized_key
|
ssh_authorized_key = var.ssh_authorized_key
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# Secure copy etcd TLS assets and kubeconfig to controllers. Activates kubelet.service
|
# Secure copy assets to controllers. Activates kubelet.service
|
||||||
resource "null_resource" "copy-controller-secrets" {
|
resource "null_resource" "copy-controller-secrets" {
|
||||||
count = length(var.controller_names)
|
count = length(var.controller_names)
|
||||||
|
|
||||||
@ -8,54 +8,60 @@ resource "null_resource" "copy-controller-secrets" {
|
|||||||
matchbox_group.install,
|
matchbox_group.install,
|
||||||
matchbox_group.controller,
|
matchbox_group.controller,
|
||||||
matchbox_group.worker,
|
matchbox_group.worker,
|
||||||
|
module.bootstrap,
|
||||||
]
|
]
|
||||||
|
|
||||||
connection {
|
connection {
|
||||||
type = "ssh"
|
type = "ssh"
|
||||||
host = element(var.controller_domains, count.index)
|
host = var.controller_domains[count.index]
|
||||||
user = "core"
|
user = "core"
|
||||||
timeout = "60m"
|
timeout = "60m"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.kubeconfig-kubelet
|
content = module.bootstrap.kubeconfig-kubelet
|
||||||
destination = "$HOME/kubeconfig"
|
destination = "$HOME/kubeconfig"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.etcd_ca_cert
|
content = module.bootstrap.etcd_ca_cert
|
||||||
destination = "$HOME/etcd-client-ca.crt"
|
destination = "$HOME/etcd-client-ca.crt"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.etcd_client_cert
|
content = module.bootstrap.etcd_client_cert
|
||||||
destination = "$HOME/etcd-client.crt"
|
destination = "$HOME/etcd-client.crt"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.etcd_client_key
|
content = module.bootstrap.etcd_client_key
|
||||||
destination = "$HOME/etcd-client.key"
|
destination = "$HOME/etcd-client.key"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.etcd_server_cert
|
content = module.bootstrap.etcd_server_cert
|
||||||
destination = "$HOME/etcd-server.crt"
|
destination = "$HOME/etcd-server.crt"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.etcd_server_key
|
content = module.bootstrap.etcd_server_key
|
||||||
destination = "$HOME/etcd-server.key"
|
destination = "$HOME/etcd-server.key"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.etcd_peer_cert
|
content = module.bootstrap.etcd_peer_cert
|
||||||
destination = "$HOME/etcd-peer.crt"
|
destination = "$HOME/etcd-peer.crt"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.etcd_peer_key
|
content = module.bootstrap.etcd_peer_key
|
||||||
destination = "$HOME/etcd-peer.key"
|
destination = "$HOME/etcd-peer.key"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
provisioner "file" {
|
||||||
|
source = var.asset_dir
|
||||||
|
destination = "$HOME/assets"
|
||||||
|
}
|
||||||
|
|
||||||
provisioner "remote-exec" {
|
provisioner "remote-exec" {
|
||||||
inline = [
|
inline = [
|
||||||
@ -69,7 +75,13 @@ resource "null_resource" "copy-controller-secrets" {
|
|||||||
"sudo mv etcd-peer.key /etc/ssl/etcd/etcd/peer.key",
|
"sudo mv etcd-peer.key /etc/ssl/etcd/etcd/peer.key",
|
||||||
"sudo chown -R etcd:etcd /etc/ssl/etcd",
|
"sudo chown -R etcd:etcd /etc/ssl/etcd",
|
||||||
"sudo chmod -R 500 /etc/ssl/etcd",
|
"sudo chmod -R 500 /etc/ssl/etcd",
|
||||||
|
"sudo mv $HOME/assets /opt/bootstrap/assets",
|
||||||
|
"sudo mkdir -p /etc/kubernetes/manifests",
|
||||||
|
"sudo mkdir -p /etc/kubernetes/bootstrap-secrets",
|
||||||
"sudo mv $HOME/kubeconfig /etc/kubernetes/kubeconfig",
|
"sudo mv $HOME/kubeconfig /etc/kubernetes/kubeconfig",
|
||||||
|
"sudo cp -r /opt/bootstrap/assets/tls/* /etc/kubernetes/bootstrap-secrets/",
|
||||||
|
"sudo cp /opt/bootstrap/assets/auth/kubeconfig /etc/kubernetes/bootstrap-secrets/",
|
||||||
|
"sudo cp -r /opt/bootstrap/assets/static-manifests/* /etc/kubernetes/manifests/",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -88,13 +100,13 @@ resource "null_resource" "copy-worker-secrets" {
|
|||||||
|
|
||||||
connection {
|
connection {
|
||||||
type = "ssh"
|
type = "ssh"
|
||||||
host = element(var.worker_domains, count.index)
|
host = var.worker_domains[count.index]
|
||||||
user = "core"
|
user = "core"
|
||||||
timeout = "60m"
|
timeout = "60m"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.kubeconfig-kubelet
|
content = module.bootstrap.kubeconfig-kubelet
|
||||||
destination = "$HOME/kubeconfig"
|
destination = "$HOME/kubeconfig"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,9 +117,8 @@ resource "null_resource" "copy-worker-secrets" {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Secure copy bootkube assets to ONE controller and start bootkube to perform
|
# Connect to a controller to perform one-time cluster bootstrap.
|
||||||
# one-time self-hosted cluster bootstrapping.
|
resource "null_resource" "bootstrap" {
|
||||||
resource "null_resource" "bootkube-start" {
|
|
||||||
# Without depends_on, this remote-exec may start before the kubeconfig copy.
|
# Without depends_on, this remote-exec may start before the kubeconfig copy.
|
||||||
# Terraform only does one task at a time, so it would try to bootstrap
|
# Terraform only does one task at a time, so it would try to bootstrap
|
||||||
# while no Kubelets are running.
|
# while no Kubelets are running.
|
||||||
@ -118,20 +129,14 @@ resource "null_resource" "bootkube-start" {
|
|||||||
|
|
||||||
connection {
|
connection {
|
||||||
type = "ssh"
|
type = "ssh"
|
||||||
host = element(var.controller_domains, 0)
|
host = var.controller_domains[0]
|
||||||
user = "core"
|
user = "core"
|
||||||
timeout = "15m"
|
timeout = "15m"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
|
||||||
source = var.asset_dir
|
|
||||||
destination = "$HOME/assets"
|
|
||||||
}
|
|
||||||
|
|
||||||
provisioner "remote-exec" {
|
provisioner "remote-exec" {
|
||||||
inline = [
|
inline = [
|
||||||
"sudo mv $HOME/assets /opt/bootkube",
|
"sudo systemctl start bootstrap",
|
||||||
"sudo systemctl start bootkube",
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,8 +62,8 @@ variable "clc_snippets" {
|
|||||||
# configuration
|
# configuration
|
||||||
|
|
||||||
variable "k8s_domain_name" {
|
variable "k8s_domain_name" {
|
||||||
description = "Controller DNS name which resolves to a controller instance. Workers and kubeconfig's will communicate with this endpoint (e.g. cluster.example.com)"
|
|
||||||
type = string
|
type = string
|
||||||
|
description = "Controller DNS name which resolves to a controller instance. Workers and kubeconfig's will communicate with this endpoint (e.g. cluster.example.com)"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "ssh_authorized_key" {
|
variable "ssh_authorized_key" {
|
||||||
@ -72,63 +72,55 @@ variable "ssh_authorized_key" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
variable "asset_dir" {
|
variable "asset_dir" {
|
||||||
description = "Path to a directory where generated assets should be placed (contains secrets)"
|
|
||||||
type = string
|
type = string
|
||||||
|
description = "Absolute path to a directory where generated assets should be placed (contains secrets)"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "networking" {
|
variable "networking" {
|
||||||
description = "Choice of networking provider (flannel or calico)"
|
|
||||||
type = string
|
type = string
|
||||||
|
description = "Choice of networking provider (flannel or calico)"
|
||||||
default = "calico"
|
default = "calico"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "network_mtu" {
|
variable "network_mtu" {
|
||||||
|
type = number
|
||||||
description = "CNI interface MTU (applies to calico only)"
|
description = "CNI interface MTU (applies to calico only)"
|
||||||
type = string
|
default = 1480
|
||||||
default = "1480"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "network_ip_autodetection_method" {
|
variable "network_ip_autodetection_method" {
|
||||||
description = "Method to autodetect the host IPv4 address (applies to calico only)"
|
|
||||||
type = string
|
type = string
|
||||||
|
description = "Method to autodetect the host IPv4 address (applies to calico only)"
|
||||||
default = "first-found"
|
default = "first-found"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "pod_cidr" {
|
variable "pod_cidr" {
|
||||||
description = "CIDR IPv4 range to assign Kubernetes pods"
|
|
||||||
type = string
|
type = string
|
||||||
|
description = "CIDR IPv4 range to assign Kubernetes pods"
|
||||||
default = "10.2.0.0/16"
|
default = "10.2.0.0/16"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "service_cidr" {
|
variable "service_cidr" {
|
||||||
|
type = string
|
||||||
description = <<EOD
|
description = <<EOD
|
||||||
CIDR IPv4 range to assign Kubernetes services.
|
CIDR IPv4 range to assign Kubernetes services.
|
||||||
The 1st IP will be reserved for kube_apiserver, the 10th IP will be reserved for coredns.
|
The 1st IP will be reserved for kube_apiserver, the 10th IP will be reserved for coredns.
|
||||||
EOD
|
EOD
|
||||||
|
|
||||||
|
|
||||||
type = string
|
|
||||||
default = "10.3.0.0/16"
|
default = "10.3.0.0/16"
|
||||||
}
|
}
|
||||||
|
|
||||||
# optional
|
# optional
|
||||||
|
|
||||||
variable "cluster_domain_suffix" {
|
|
||||||
description = "Queries for domains with the suffix will be answered by coredns. Default is cluster.local (e.g. foo.default.svc.cluster.local) "
|
|
||||||
type = string
|
|
||||||
default = "cluster.local"
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "download_protocol" {
|
variable "download_protocol" {
|
||||||
type = string
|
type = string
|
||||||
default = "https"
|
|
||||||
description = "Protocol iPXE should use to download the kernel and initrd. Defaults to https, which requires iPXE compiled with crypto support. Unused if cached_install is true."
|
description = "Protocol iPXE should use to download the kernel and initrd. Defaults to https, which requires iPXE compiled with crypto support. Unused if cached_install is true."
|
||||||
|
default = "https"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "cached_install" {
|
variable "cached_install" {
|
||||||
type = string
|
type = bool
|
||||||
default = "false"
|
|
||||||
description = "Whether Container Linux should PXE boot and install from matchbox /assets cache. Note that the admin must have downloaded the os_version into matchbox assets."
|
description = "Whether Container Linux should PXE boot and install from matchbox /assets cache. Note that the admin must have downloaded the os_version into matchbox assets."
|
||||||
|
default = false
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "install_disk" {
|
variable "install_disk" {
|
||||||
@ -137,27 +129,29 @@ variable "install_disk" {
|
|||||||
description = "Disk device to which the install profiles should install Container Linux (e.g. /dev/sda)"
|
description = "Disk device to which the install profiles should install Container Linux (e.g. /dev/sda)"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "container_linux_oem" {
|
|
||||||
type = string
|
|
||||||
default = ""
|
|
||||||
description = "DEPRECATED: Specify an OEM image id to use as base for the installation (e.g. ami, vmware_raw, xen) or leave blank for the default image"
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "kernel_args" {
|
variable "kernel_args" {
|
||||||
description = "Additional kernel arguments to provide at PXE boot."
|
|
||||||
type = list(string)
|
type = list(string)
|
||||||
|
description = "Additional kernel arguments to provide at PXE boot."
|
||||||
default = []
|
default = []
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "enable_reporting" {
|
variable "enable_reporting" {
|
||||||
type = string
|
type = bool
|
||||||
description = "Enable usage or analytics reporting to upstreams (Calico)"
|
description = "Enable usage or analytics reporting to upstreams (Calico)"
|
||||||
default = "false"
|
default = false
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "enable_aggregation" {
|
variable "enable_aggregation" {
|
||||||
|
type = bool
|
||||||
description = "Enable the Kubernetes Aggregation Layer (defaults to false)"
|
description = "Enable the Kubernetes Aggregation Layer (defaults to false)"
|
||||||
type = string
|
default = false
|
||||||
default = "false"
|
}
|
||||||
|
|
||||||
|
# unofficial, undocumented, unsupported
|
||||||
|
|
||||||
|
variable "cluster_domain_suffix" {
|
||||||
|
type = string
|
||||||
|
description = "Queries for domains with the suffix will be answered by coredns. Default is cluster.local (e.g. foo.default.svc.cluster.local) "
|
||||||
|
default = "cluster.local"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ Typhoon distributes upstream Kubernetes, architectural conventions, and cluster
|
|||||||
|
|
||||||
## Features <a href="https://www.cncf.io/certification/software-conformance/"><img align="right" src="https://storage.googleapis.com/poseidon/certified-kubernetes.png"></a>
|
## Features <a href="https://www.cncf.io/certification/software-conformance/"><img align="right" src="https://storage.googleapis.com/poseidon/certified-kubernetes.png"></a>
|
||||||
|
|
||||||
* Kubernetes v1.15.1 (upstream, via [kubernetes-incubator/bootkube](https://github.com/kubernetes-incubator/bootkube))
|
* Kubernetes v1.16.1 (upstream)
|
||||||
* Single or multi-master, [Calico](https://www.projectcalico.org/) or [flannel](https://github.com/coreos/flannel) networking
|
* Single or multi-master, [Calico](https://www.projectcalico.org/) or [flannel](https://github.com/coreos/flannel) networking
|
||||||
* On-cluster etcd with TLS, [RBAC](https://kubernetes.io/docs/admin/authorization/rbac/)-enabled, [network policy](https://kubernetes.io/docs/concepts/services-networking/network-policies/)
|
* On-cluster etcd with TLS, [RBAC](https://kubernetes.io/docs/admin/authorization/rbac/)-enabled, [network policy](https://kubernetes.io/docs/concepts/services-networking/network-policies/)
|
||||||
* Advanced features like [snippets](https://typhoon.psdn.io/advanced/customization/#container-linux) customization
|
* Advanced features like [snippets](https://typhoon.psdn.io/advanced/customization/#container-linux) customization
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Self-hosted Kubernetes assets (kubeconfig, manifests)
|
# Kubernetes assets (kubeconfig, manifests)
|
||||||
module "bootkube" {
|
module "bootstrap" {
|
||||||
source = "git::https://github.com/poseidon/terraform-render-bootkube.git?ref=5b9faa903182505ac534f42a2cf250d5d215941b"
|
source = "git::https://github.com/poseidon/terraform-render-bootstrap.git?ref=586d6e36f67c56fb2283f317a7552638368c5779"
|
||||||
|
|
||||||
cluster_name = var.cluster_name
|
cluster_name = var.cluster_name
|
||||||
api_servers = [var.k8s_domain_name]
|
api_servers = [var.k8s_domain_name]
|
@ -28,7 +28,7 @@ systemd:
|
|||||||
--network host \
|
--network host \
|
||||||
--volume /var/lib/etcd:/var/lib/etcd:rw,Z \
|
--volume /var/lib/etcd:/var/lib/etcd:rw,Z \
|
||||||
--volume /etc/ssl/etcd:/etc/ssl/certs:ro,Z \
|
--volume /etc/ssl/etcd:/etc/ssl/certs:ro,Z \
|
||||||
quay.io/coreos/etcd:v3.3.13
|
quay.io/coreos/etcd:v3.4.1
|
||||||
ExecStop=/usr/bin/podman stop etcd
|
ExecStop=/usr/bin/podman stop etcd
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
@ -55,9 +55,9 @@ systemd:
|
|||||||
[Service]
|
[Service]
|
||||||
ExecStartPre=/bin/mkdir -p /etc/kubernetes/cni/net.d
|
ExecStartPre=/bin/mkdir -p /etc/kubernetes/cni/net.d
|
||||||
ExecStartPre=/bin/mkdir -p /etc/kubernetes/manifests
|
ExecStartPre=/bin/mkdir -p /etc/kubernetes/manifests
|
||||||
|
ExecStartPre=/bin/mkdir -p /opt/cni/bin
|
||||||
ExecStartPre=/bin/mkdir -p /var/lib/calico
|
ExecStartPre=/bin/mkdir -p /var/lib/calico
|
||||||
ExecStartPre=/bin/mkdir -p /var/lib/kubelet/volumeplugins
|
ExecStartPre=/bin/mkdir -p /var/lib/kubelet/volumeplugins
|
||||||
ExecStartPre=/bin/mkdir -p /opt/cni/bin
|
|
||||||
ExecStartPre=/usr/bin/bash -c "grep 'certificate-authority-data' /etc/kubernetes/kubeconfig | awk '{print $2}' | base64 -d > /etc/kubernetes/ca.crt"
|
ExecStartPre=/usr/bin/bash -c "grep 'certificate-authority-data' /etc/kubernetes/kubeconfig | awk '{print $2}' | base64 -d > /etc/kubernetes/ca.crt"
|
||||||
ExecStartPre=-/usr/bin/podman rm kubelet
|
ExecStartPre=-/usr/bin/podman rm kubelet
|
||||||
ExecStart=/usr/bin/podman run --name kubelet \
|
ExecStart=/usr/bin/podman run --name kubelet \
|
||||||
@ -81,13 +81,13 @@ systemd:
|
|||||||
--volume /opt/cni/bin:/opt/cni/bin:z \
|
--volume /opt/cni/bin:/opt/cni/bin:z \
|
||||||
--volume /etc/iscsi:/etc/iscsi \
|
--volume /etc/iscsi:/etc/iscsi \
|
||||||
--volume /sbin/iscsiadm:/sbin/iscsiadm \
|
--volume /sbin/iscsiadm:/sbin/iscsiadm \
|
||||||
k8s.gcr.io/hyperkube:v1.15.1 /hyperkube kubelet \
|
k8s.gcr.io/hyperkube:v1.16.1 /hyperkube kubelet \
|
||||||
--anonymous-auth=false \
|
--anonymous-auth=false \
|
||||||
--authentication-token-webhook \
|
--authentication-token-webhook \
|
||||||
--authorization-mode=Webhook \
|
--authorization-mode=Webhook \
|
||||||
--cgroup-driver=systemd \
|
--cgroup-driver=systemd \
|
||||||
--cgroups-per-qos=false \
|
--cgroups-per-qos=true \
|
||||||
--enforce-node-allocatable="" \
|
--enforce-node-allocatable=pods \
|
||||||
--client-ca-file=/etc/kubernetes/ca.crt \
|
--client-ca-file=/etc/kubernetes/ca.crt \
|
||||||
--cluster_dns=${cluster_dns_service_ip} \
|
--cluster_dns=${cluster_dns_service_ip} \
|
||||||
--cluster_domain=${cluster_domain_suffix} \
|
--cluster_domain=${cluster_domain_suffix} \
|
||||||
@ -97,8 +97,8 @@ systemd:
|
|||||||
--kubeconfig=/etc/kubernetes/kubeconfig \
|
--kubeconfig=/etc/kubernetes/kubeconfig \
|
||||||
--lock-file=/var/run/lock/kubelet.lock \
|
--lock-file=/var/run/lock/kubelet.lock \
|
||||||
--network-plugin=cni \
|
--network-plugin=cni \
|
||||||
--node-labels=node-role.kubernetes.io/master \
|
--node-labels=node.kubernetes.io/master \
|
||||||
--node-labels=node-role.kubernetes.io/controller="true" \
|
--node-labels=node.kubernetes.io/controller="true" \
|
||||||
--pod-manifest-path=/etc/kubernetes/manifests \
|
--pod-manifest-path=/etc/kubernetes/manifests \
|
||||||
--read-only-port=0 \
|
--read-only-port=0 \
|
||||||
--register-with-taints=node-role.kubernetes.io/master=:NoSchedule \
|
--register-with-taints=node-role.kubernetes.io/master=:NoSchedule \
|
||||||
@ -118,33 +118,48 @@ systemd:
|
|||||||
PathExists=/etc/kubernetes/kubeconfig
|
PathExists=/etc/kubernetes/kubeconfig
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
- name: bootkube.service
|
- name: bootstrap.service
|
||||||
contents: |
|
contents: |
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Bootstrap a Kubernetes control plane
|
Description=Kubernetes control plane
|
||||||
ConditionPathExists=!/opt/bootkube/init_bootkube.done
|
ConditionPathExists=!/opt/bootstrap/bootstrap.done
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
RemainAfterExit=true
|
RemainAfterExit=true
|
||||||
WorkingDirectory=/opt/bootkube
|
WorkingDirectory=/opt/bootstrap
|
||||||
ExecStart=/usr/bin/bash -c 'set -x && \
|
ExecStartPre=-/usr/bin/bash -c 'set -x && [ -n "$(ls /opt/bootstrap/assets/manifests-*/* 2>/dev/null)" ] && mv /opt/bootstrap/assets/manifests-*/* /opt/bootstrap/assets/manifests && rm -rf /opt/bootstrap/assets/manifests-*'
|
||||||
[ -n "$(ls /opt/bootkube/assets/manifests-*/* 2>/dev/null)" ] && mv /opt/bootkube/assets/manifests-*/* /opt/bootkube/assets/manifests && rm -rf /opt/bootkube/assets/manifests-* && exec podman run --name bootkube --privileged \
|
ExecStart=/usr/bin/podman run --name bootstrap \
|
||||||
--network host \
|
--network host \
|
||||||
--volume /opt/bootkube/assets:/assets \
|
--volume /opt/bootstrap/assets:/assets:ro,Z \
|
||||||
--volume /etc/kubernetes:/etc/kubernetes \
|
--volume /opt/bootstrap/apply:/apply:ro,Z \
|
||||||
quay.io/coreos/bootkube:v0.14.0 \
|
k8s.gcr.io/hyperkube:v1.16.1 \
|
||||||
/bootkube start --asset-dir=/assets'
|
/apply
|
||||||
ExecStartPost=/bin/touch /opt/bootkube/init_bootkube.done
|
ExecStartPost=/bin/touch /opt/bootstrap/bootstrap.done
|
||||||
|
ExecStartPost=-/usr/bin/podman stop bootstrap
|
||||||
storage:
|
storage:
|
||||||
directories:
|
directories:
|
||||||
- path: /etc/kubernetes
|
- path: /etc/kubernetes
|
||||||
- path: /opt/bootkube
|
- path: /opt/bootstrap
|
||||||
files:
|
files:
|
||||||
- path: /etc/hostname
|
- path: /etc/hostname
|
||||||
mode: 0644
|
mode: 0644
|
||||||
contents:
|
contents:
|
||||||
inline:
|
inline:
|
||||||
${domain_name}
|
${domain_name}
|
||||||
|
- path: /opt/bootstrap/apply
|
||||||
|
mode: 0544
|
||||||
|
contents:
|
||||||
|
inline: |
|
||||||
|
#!/bin/bash -e
|
||||||
|
export KUBECONFIG=/assets/auth/kubeconfig
|
||||||
|
until kubectl version; do
|
||||||
|
echo "Waiting for static pod control plane"
|
||||||
|
sleep 5
|
||||||
|
done
|
||||||
|
until kubectl apply -f /assets/manifests -R; do
|
||||||
|
echo "Retry applying manifests"
|
||||||
|
sleep 5
|
||||||
|
done
|
||||||
- path: /etc/sysctl.d/reverse-path-filter.conf
|
- path: /etc/sysctl.d/reverse-path-filter.conf
|
||||||
contents:
|
contents:
|
||||||
inline: |
|
inline: |
|
||||||
|
@ -25,9 +25,9 @@ systemd:
|
|||||||
[Service]
|
[Service]
|
||||||
ExecStartPre=/bin/mkdir -p /etc/kubernetes/cni/net.d
|
ExecStartPre=/bin/mkdir -p /etc/kubernetes/cni/net.d
|
||||||
ExecStartPre=/bin/mkdir -p /etc/kubernetes/manifests
|
ExecStartPre=/bin/mkdir -p /etc/kubernetes/manifests
|
||||||
|
ExecStartPre=/bin/mkdir -p /opt/cni/bin
|
||||||
ExecStartPre=/bin/mkdir -p /var/lib/calico
|
ExecStartPre=/bin/mkdir -p /var/lib/calico
|
||||||
ExecStartPre=/bin/mkdir -p /var/lib/kubelet/volumeplugins
|
ExecStartPre=/bin/mkdir -p /var/lib/kubelet/volumeplugins
|
||||||
ExecStartPre=/bin/mkdir -p /opt/cni/bin
|
|
||||||
ExecStartPre=/usr/bin/bash -c "grep 'certificate-authority-data' /etc/kubernetes/kubeconfig | awk '{print $2}' | base64 -d > /etc/kubernetes/ca.crt"
|
ExecStartPre=/usr/bin/bash -c "grep 'certificate-authority-data' /etc/kubernetes/kubeconfig | awk '{print $2}' | base64 -d > /etc/kubernetes/ca.crt"
|
||||||
ExecStartPre=-/usr/bin/podman rm kubelet
|
ExecStartPre=-/usr/bin/podman rm kubelet
|
||||||
ExecStart=/usr/bin/podman run --name kubelet \
|
ExecStart=/usr/bin/podman run --name kubelet \
|
||||||
@ -51,7 +51,7 @@ systemd:
|
|||||||
--volume /opt/cni/bin:/opt/cni/bin:z \
|
--volume /opt/cni/bin:/opt/cni/bin:z \
|
||||||
--volume /etc/iscsi:/etc/iscsi \
|
--volume /etc/iscsi:/etc/iscsi \
|
||||||
--volume /sbin/iscsiadm:/sbin/iscsiadm \
|
--volume /sbin/iscsiadm:/sbin/iscsiadm \
|
||||||
k8s.gcr.io/hyperkube:v1.15.1 /hyperkube kubelet \
|
k8s.gcr.io/hyperkube:v1.16.1 /hyperkube kubelet \
|
||||||
--anonymous-auth=false \
|
--anonymous-auth=false \
|
||||||
--authentication-token-webhook \
|
--authentication-token-webhook \
|
||||||
--authorization-mode=Webhook \
|
--authorization-mode=Webhook \
|
||||||
@ -67,7 +67,7 @@ systemd:
|
|||||||
--kubeconfig=/etc/kubernetes/kubeconfig \
|
--kubeconfig=/etc/kubernetes/kubeconfig \
|
||||||
--lock-file=/var/run/lock/kubelet.lock \
|
--lock-file=/var/run/lock/kubelet.lock \
|
||||||
--network-plugin=cni \
|
--network-plugin=cni \
|
||||||
--node-labels=node-role.kubernetes.io/node \
|
--node-labels=node.kubernetes.io/node \
|
||||||
--pod-manifest-path=/etc/kubernetes/manifests \
|
--pod-manifest-path=/etc/kubernetes/manifests \
|
||||||
--read-only-port=0 \
|
--read-only-port=0 \
|
||||||
--volume-plugin-dir=/var/lib/kubelet/volumeplugins
|
--volume-plugin-dir=/var/lib/kubelet/volumeplugins
|
||||||
@ -89,7 +89,6 @@ systemd:
|
|||||||
storage:
|
storage:
|
||||||
directories:
|
directories:
|
||||||
- path: /etc/kubernetes
|
- path: /etc/kubernetes
|
||||||
- path: /opt/bootkube
|
|
||||||
files:
|
files:
|
||||||
- path: /etc/hostname
|
- path: /etc/hostname
|
||||||
mode: 0644
|
mode: 0644
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
output "kubeconfig-admin" {
|
output "kubeconfig-admin" {
|
||||||
value = module.bootkube.kubeconfig-admin
|
value = module.bootstrap.kubeconfig-admin
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,29 +1,29 @@
|
|||||||
locals {
|
locals {
|
||||||
remote_kernel = "https://builds.coreos.fedoraproject.org/prod/streams/${var.os_stream}/builds/${var.os_version}/x86_64/fedora-coreos-${var.os_version}-installer-kernel"
|
remote_kernel = "https://builds.coreos.fedoraproject.org/prod/streams/${var.os_stream}/builds/${var.os_version}/x86_64/fedora-coreos-${var.os_version}-installer-kernel-x86_64"
|
||||||
remote_initrd = "https://builds.coreos.fedoraproject.org/prod/streams/${var.os_stream}/builds/${var.os_version}/x86_64/fedora-coreos-${var.os_version}-installer-initramfs.img"
|
remote_initrd = "https://builds.coreos.fedoraproject.org/prod/streams/${var.os_stream}/builds/${var.os_version}/x86_64/fedora-coreos-${var.os_version}-installer-initramfs.x86_64.img"
|
||||||
remote_args = [
|
remote_args = [
|
||||||
"ip=dhcp",
|
"ip=dhcp",
|
||||||
"rd.neednet=1",
|
"rd.neednet=1",
|
||||||
"coreos.inst=yes",
|
"coreos.inst=yes",
|
||||||
"coreos.inst.image_url=https://builds.coreos.fedoraproject.org/prod/streams/${var.os_stream}/builds/${var.os_version}/x86_64/fedora-coreos-${var.os_version}-metal.raw.xz",
|
"coreos.inst.image_url=https://builds.coreos.fedoraproject.org/prod/streams/${var.os_stream}/builds/${var.os_version}/x86_64/fedora-coreos-${var.os_version}-metal.x86_64.raw.xz",
|
||||||
"coreos.inst.ignition_url=${var.matchbox_http_endpoint}/ignition?uuid=$${uuid}&mac=$${mac:hexhyp}",
|
"coreos.inst.ignition_url=${var.matchbox_http_endpoint}/ignition?uuid=$${uuid}&mac=$${mac:hexhyp}",
|
||||||
"coreos.inst.install_dev=${var.install_disk}"
|
"coreos.inst.install_dev=${var.install_disk}"
|
||||||
]
|
]
|
||||||
|
|
||||||
cached_kernel = "/assets/fedora-coreos/fedora-coreos-${var.os_version}-installer-kernel"
|
cached_kernel = "/assets/fedora-coreos/fedora-coreos-${var.os_version}-installer-kernel-x86_64"
|
||||||
cached_initrd = "/assets/fedora-coreos/fedora-coreos-${var.os_version}-installer-initramfs.img"
|
cached_initrd = "/assets/fedora-coreos/fedora-coreos-${var.os_version}-installer-initramfs.x86_64.img"
|
||||||
cached_args = [
|
cached_args = [
|
||||||
"ip=dhcp",
|
"ip=dhcp",
|
||||||
"rd.neednet=1",
|
"rd.neednet=1",
|
||||||
"coreos.inst=yes",
|
"coreos.inst=yes",
|
||||||
"coreos.inst.image_url=${var.matchbox_http_endpoint}/assets/fedora-coreos/fedora-coreos-${var.os_version}-metal.raw.xz",
|
"coreos.inst.image_url=${var.matchbox_http_endpoint}/assets/fedora-coreos/fedora-coreos-${var.os_version}-metal.x86_64.raw.xz",
|
||||||
"coreos.inst.ignition_url=${var.matchbox_http_endpoint}/ignition?uuid=$${uuid}&mac=$${mac:hexhyp}",
|
"coreos.inst.ignition_url=${var.matchbox_http_endpoint}/ignition?uuid=$${uuid}&mac=$${mac:hexhyp}",
|
||||||
"coreos.inst.install_dev=${var.install_disk}"
|
"coreos.inst.install_dev=${var.install_disk}"
|
||||||
]
|
]
|
||||||
|
|
||||||
kernel = var.cached_install == "true" ? local.cached_kernel : local.remote_kernel
|
kernel = var.cached_install ? local.cached_kernel : local.remote_kernel
|
||||||
initrd = var.cached_install == "true" ? local.cached_initrd : local.remote_initrd
|
initrd = var.cached_install ? local.cached_initrd : local.remote_initrd
|
||||||
args = var.cached_install == "true" ? local.cached_args : local.remote_args
|
args = var.cached_install ? local.cached_args : local.remote_args
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ data "template_file" "controller-configs" {
|
|||||||
domain_name = var.controller_domains[count.index]
|
domain_name = var.controller_domains[count.index]
|
||||||
etcd_name = var.controller_names[count.index]
|
etcd_name = var.controller_names[count.index]
|
||||||
etcd_initial_cluster = join(",", formatlist("%s=https://%s:2380", var.controller_names, var.controller_domains))
|
etcd_initial_cluster = join(",", formatlist("%s=https://%s:2380", var.controller_names, var.controller_domains))
|
||||||
cluster_dns_service_ip = module.bootkube.cluster_dns_service_ip
|
cluster_dns_service_ip = module.bootstrap.cluster_dns_service_ip
|
||||||
cluster_domain_suffix = var.cluster_domain_suffix
|
cluster_domain_suffix = var.cluster_domain_suffix
|
||||||
ssh_authorized_key = var.ssh_authorized_key
|
ssh_authorized_key = var.ssh_authorized_key
|
||||||
}
|
}
|
||||||
@ -89,7 +89,7 @@ data "template_file" "worker-configs" {
|
|||||||
template = file("${path.module}/fcc/worker.yaml")
|
template = file("${path.module}/fcc/worker.yaml")
|
||||||
vars = {
|
vars = {
|
||||||
domain_name = var.worker_domains[count.index]
|
domain_name = var.worker_domains[count.index]
|
||||||
cluster_dns_service_ip = module.bootkube.cluster_dns_service_ip
|
cluster_dns_service_ip = module.bootstrap.cluster_dns_service_ip
|
||||||
cluster_domain_suffix = var.cluster_domain_suffix
|
cluster_domain_suffix = var.cluster_domain_suffix
|
||||||
ssh_authorized_key = var.ssh_authorized_key
|
ssh_authorized_key = var.ssh_authorized_key
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# Secure copy etcd TLS assets and kubeconfig to controllers. Activates kubelet.service
|
# Secure copy assets to controllers. Activates kubelet.service
|
||||||
resource "null_resource" "copy-controller-secrets" {
|
resource "null_resource" "copy-controller-secrets" {
|
||||||
count = length(var.controller_names)
|
count = length(var.controller_names)
|
||||||
|
|
||||||
@ -7,6 +7,7 @@ resource "null_resource" "copy-controller-secrets" {
|
|||||||
depends_on = [
|
depends_on = [
|
||||||
matchbox_group.controller,
|
matchbox_group.controller,
|
||||||
matchbox_group.worker,
|
matchbox_group.worker,
|
||||||
|
module.bootstrap,
|
||||||
]
|
]
|
||||||
|
|
||||||
connection {
|
connection {
|
||||||
@ -17,44 +18,49 @@ resource "null_resource" "copy-controller-secrets" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.kubeconfig-kubelet
|
content = module.bootstrap.kubeconfig-kubelet
|
||||||
destination = "$HOME/kubeconfig"
|
destination = "$HOME/kubeconfig"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.etcd_ca_cert
|
content = module.bootstrap.etcd_ca_cert
|
||||||
destination = "$HOME/etcd-client-ca.crt"
|
destination = "$HOME/etcd-client-ca.crt"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.etcd_client_cert
|
content = module.bootstrap.etcd_client_cert
|
||||||
destination = "$HOME/etcd-client.crt"
|
destination = "$HOME/etcd-client.crt"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.etcd_client_key
|
content = module.bootstrap.etcd_client_key
|
||||||
destination = "$HOME/etcd-client.key"
|
destination = "$HOME/etcd-client.key"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.etcd_server_cert
|
content = module.bootstrap.etcd_server_cert
|
||||||
destination = "$HOME/etcd-server.crt"
|
destination = "$HOME/etcd-server.crt"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.etcd_server_key
|
content = module.bootstrap.etcd_server_key
|
||||||
destination = "$HOME/etcd-server.key"
|
destination = "$HOME/etcd-server.key"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.etcd_peer_cert
|
content = module.bootstrap.etcd_peer_cert
|
||||||
destination = "$HOME/etcd-peer.crt"
|
destination = "$HOME/etcd-peer.crt"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.etcd_peer_key
|
content = module.bootstrap.etcd_peer_key
|
||||||
destination = "$HOME/etcd-peer.key"
|
destination = "$HOME/etcd-peer.key"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
provisioner "file" {
|
||||||
|
source = var.asset_dir
|
||||||
|
destination = "$HOME/assets"
|
||||||
|
}
|
||||||
|
|
||||||
provisioner "remote-exec" {
|
provisioner "remote-exec" {
|
||||||
inline = [
|
inline = [
|
||||||
@ -66,7 +72,13 @@ resource "null_resource" "copy-controller-secrets" {
|
|||||||
"sudo cp /etc/ssl/etcd/etcd-client-ca.crt /etc/ssl/etcd/etcd/peer-ca.crt",
|
"sudo cp /etc/ssl/etcd/etcd-client-ca.crt /etc/ssl/etcd/etcd/peer-ca.crt",
|
||||||
"sudo mv etcd-peer.crt /etc/ssl/etcd/etcd/peer.crt",
|
"sudo mv etcd-peer.crt /etc/ssl/etcd/etcd/peer.crt",
|
||||||
"sudo mv etcd-peer.key /etc/ssl/etcd/etcd/peer.key",
|
"sudo mv etcd-peer.key /etc/ssl/etcd/etcd/peer.key",
|
||||||
|
"sudo mv $HOME/assets /opt/bootstrap/assets",
|
||||||
|
"sudo mkdir -p /etc/kubernetes/manifests",
|
||||||
|
"sudo mkdir -p /etc/kubernetes/bootstrap-secrets",
|
||||||
"sudo mv $HOME/kubeconfig /etc/kubernetes/kubeconfig",
|
"sudo mv $HOME/kubeconfig /etc/kubernetes/kubeconfig",
|
||||||
|
"sudo cp -r /opt/bootstrap/assets/tls/* /etc/kubernetes/bootstrap-secrets/",
|
||||||
|
"sudo cp /opt/bootstrap/assets/auth/kubeconfig /etc/kubernetes/bootstrap-secrets/",
|
||||||
|
"sudo cp -r /opt/bootstrap/assets/static-manifests/* /etc/kubernetes/manifests/"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -90,7 +102,7 @@ resource "null_resource" "copy-worker-secrets" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.kubeconfig-kubelet
|
content = module.bootstrap.kubeconfig-kubelet
|
||||||
destination = "$HOME/kubeconfig"
|
destination = "$HOME/kubeconfig"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,9 +113,8 @@ resource "null_resource" "copy-worker-secrets" {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Secure copy bootkube assets to ONE controller and start bootkube to perform
|
# Connect to a controller to perform one-time cluster bootstrap.
|
||||||
# one-time self-hosted cluster bootstrapping.
|
resource "null_resource" "bootstrap" {
|
||||||
resource "null_resource" "bootkube-start" {
|
|
||||||
# Without depends_on, this remote-exec may start before the kubeconfig copy.
|
# Without depends_on, this remote-exec may start before the kubeconfig copy.
|
||||||
# Terraform only does one task at a time, so it would try to bootstrap
|
# Terraform only does one task at a time, so it would try to bootstrap
|
||||||
# while no Kubelets are running.
|
# while no Kubelets are running.
|
||||||
@ -119,15 +130,9 @@ resource "null_resource" "bootkube-start" {
|
|||||||
timeout = "15m"
|
timeout = "15m"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
|
||||||
source = var.asset_dir
|
|
||||||
destination = "$HOME/assets"
|
|
||||||
}
|
|
||||||
|
|
||||||
provisioner "remote-exec" {
|
provisioner "remote-exec" {
|
||||||
inline = [
|
inline = [
|
||||||
"sudo mv $HOME/assets /opt/bootkube",
|
"sudo systemctl start bootstrap",
|
||||||
"sudo systemctl start bootkube",
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,8 +63,8 @@ variable "snippets" {
|
|||||||
# configuration
|
# configuration
|
||||||
|
|
||||||
variable "k8s_domain_name" {
|
variable "k8s_domain_name" {
|
||||||
description = "Controller DNS name which resolves to a controller instance. Workers and kubeconfig's will communicate with this endpoint (e.g. cluster.example.com)"
|
|
||||||
type = string
|
type = string
|
||||||
|
description = "Controller DNS name which resolves to a controller instance. Workers and kubeconfig's will communicate with this endpoint (e.g. cluster.example.com)"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "ssh_authorized_key" {
|
variable "ssh_authorized_key" {
|
||||||
@ -73,86 +73,80 @@ variable "ssh_authorized_key" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
variable "asset_dir" {
|
variable "asset_dir" {
|
||||||
description = "Path to a directory where generated assets should be placed (contains secrets)"
|
|
||||||
type = string
|
type = string
|
||||||
|
description = "Absolute path to a directory where generated assets should be placed (contains secrets)"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "networking" {
|
variable "networking" {
|
||||||
description = "Choice of networking provider (flannel or calico)"
|
|
||||||
type = string
|
type = string
|
||||||
|
description = "Choice of networking provider (flannel or calico)"
|
||||||
default = "calico"
|
default = "calico"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "network_mtu" {
|
variable "network_mtu" {
|
||||||
|
type = number
|
||||||
description = "CNI interface MTU (applies to calico only)"
|
description = "CNI interface MTU (applies to calico only)"
|
||||||
type = string
|
default = 1480
|
||||||
default = "1480"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "network_ip_autodetection_method" {
|
variable "network_ip_autodetection_method" {
|
||||||
description = "Method to autodetect the host IPv4 address (applies to calico only)"
|
|
||||||
type = string
|
type = string
|
||||||
|
description = "Method to autodetect the host IPv4 address (applies to calico only)"
|
||||||
default = "first-found"
|
default = "first-found"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "pod_cidr" {
|
variable "pod_cidr" {
|
||||||
description = "CIDR IPv4 range to assign Kubernetes pods"
|
|
||||||
type = string
|
type = string
|
||||||
|
description = "CIDR IPv4 range to assign Kubernetes pods"
|
||||||
default = "10.2.0.0/16"
|
default = "10.2.0.0/16"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "service_cidr" {
|
variable "service_cidr" {
|
||||||
|
type = string
|
||||||
description = <<EOD
|
description = <<EOD
|
||||||
CIDR IPv4 range to assign Kubernetes services.
|
CIDR IPv4 range to assign Kubernetes services.
|
||||||
The 1st IP will be reserved for kube_apiserver, the 10th IP will be reserved for coredns.
|
The 1st IP will be reserved for kube_apiserver, the 10th IP will be reserved for coredns.
|
||||||
EOD
|
EOD
|
||||||
|
|
||||||
|
|
||||||
type = string
|
|
||||||
default = "10.3.0.0/16"
|
default = "10.3.0.0/16"
|
||||||
}
|
}
|
||||||
|
|
||||||
# optional
|
# optional
|
||||||
|
|
||||||
|
variable "cached_install" {
|
||||||
|
type = bool
|
||||||
|
description = "Whether Fedora CoreOS should PXE boot and install from matchbox /assets cache. Note that the admin must have downloaded the os_version into matchbox assets."
|
||||||
|
default = false
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "install_disk" {
|
||||||
|
type = string
|
||||||
|
description = "Disk device to install Fedora CoreOS (e.g. sda)"
|
||||||
|
default = "sda"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "kernel_args" {
|
||||||
|
type = list(string)
|
||||||
|
description = "Additional kernel arguments to provide at PXE boot."
|
||||||
|
default = []
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "enable_reporting" {
|
||||||
|
type = bool
|
||||||
|
description = "Enable usage or analytics reporting to upstreams (Calico)"
|
||||||
|
default = false
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "enable_aggregation" {
|
||||||
|
type = bool
|
||||||
|
description = "Enable the Kubernetes Aggregation Layer (defaults to false)"
|
||||||
|
default = false
|
||||||
|
}
|
||||||
|
|
||||||
|
# unofficial, undocumented, unsupported
|
||||||
|
|
||||||
variable "cluster_domain_suffix" {
|
variable "cluster_domain_suffix" {
|
||||||
description = "Queries for domains with the suffix will be answered by coredns. Default is cluster.local (e.g. foo.default.svc.cluster.local) "
|
description = "Queries for domains with the suffix will be answered by coredns. Default is cluster.local (e.g. foo.default.svc.cluster.local) "
|
||||||
type = string
|
type = string
|
||||||
default = "cluster.local"
|
default = "cluster.local"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "download_protocol" {
|
|
||||||
type = string
|
|
||||||
default = "https"
|
|
||||||
description = "Protocol iPXE should use to download the kernel and initrd. Defaults to https, which requires iPXE compiled with crypto support. Unused if cached_install is true."
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "cached_install" {
|
|
||||||
type = string
|
|
||||||
default = "false"
|
|
||||||
description = "Whether Fedora CoreOS should PXE boot and install from matchbox /assets cache. Note that the admin must have downloaded the os_version into matchbox assets."
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "install_disk" {
|
|
||||||
type = string
|
|
||||||
default = "sda"
|
|
||||||
description = "Disk device to install Fedora CoreOS (e.g. sda)"
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "kernel_args" {
|
|
||||||
description = "Additional kernel arguments to provide at PXE boot."
|
|
||||||
type = list(string)
|
|
||||||
default = []
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "enable_reporting" {
|
|
||||||
type = string
|
|
||||||
description = "Enable usage or analytics reporting to upstreams (Calico)"
|
|
||||||
default = "false"
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "enable_aggregation" {
|
|
||||||
description = "Enable the Kubernetes Aggregation Layer (defaults to false)"
|
|
||||||
type = string
|
|
||||||
default = "false"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ Typhoon distributes upstream Kubernetes, architectural conventions, and cluster
|
|||||||
|
|
||||||
## Features <a href="https://www.cncf.io/certification/software-conformance/"><img align="right" src="https://storage.googleapis.com/poseidon/certified-kubernetes.png"></a>
|
## Features <a href="https://www.cncf.io/certification/software-conformance/"><img align="right" src="https://storage.googleapis.com/poseidon/certified-kubernetes.png"></a>
|
||||||
|
|
||||||
* Kubernetes v1.15.1 (upstream, via [kubernetes-incubator/bootkube](https://github.com/kubernetes-incubator/bootkube))
|
* Kubernetes v1.16.1 (upstream)
|
||||||
* Single or multi-master, [Calico](https://www.projectcalico.org/) or [flannel](https://github.com/coreos/flannel) networking
|
* Single or multi-master, [Calico](https://www.projectcalico.org/) or [flannel](https://github.com/coreos/flannel) networking
|
||||||
* On-cluster etcd with TLS, [RBAC](https://kubernetes.io/docs/admin/authorization/rbac/)-enabled, [network policy](https://kubernetes.io/docs/concepts/services-networking/network-policies/)
|
* On-cluster etcd with TLS, [RBAC](https://kubernetes.io/docs/admin/authorization/rbac/)-enabled, [network policy](https://kubernetes.io/docs/concepts/services-networking/network-policies/)
|
||||||
* Advanced features like [snippets](https://typhoon.psdn.io/advanced/customization/#container-linux) customization
|
* Advanced features like [snippets](https://typhoon.psdn.io/advanced/customization/#container-linux) customization
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Self-hosted Kubernetes assets (kubeconfig, manifests)
|
# Kubernetes assets (kubeconfig, manifests)
|
||||||
module "bootkube" {
|
module "bootstrap" {
|
||||||
source = "git::https://github.com/poseidon/terraform-render-bootkube.git?ref=5b9faa903182505ac534f42a2cf250d5d215941b"
|
source = "git::https://github.com/poseidon/terraform-render-bootstrap.git?ref=586d6e36f67c56fb2283f317a7552638368c5779"
|
||||||
|
|
||||||
cluster_name = var.cluster_name
|
cluster_name = var.cluster_name
|
||||||
api_servers = [format("%s.%s", var.cluster_name, var.dns_zone)]
|
api_servers = [format("%s.%s", var.cluster_name, var.dns_zone)]
|
@ -7,7 +7,7 @@ systemd:
|
|||||||
- name: 40-etcd-cluster.conf
|
- name: 40-etcd-cluster.conf
|
||||||
contents: |
|
contents: |
|
||||||
[Service]
|
[Service]
|
||||||
Environment="ETCD_IMAGE_TAG=v3.3.13"
|
Environment="ETCD_IMAGE_TAG=v3.4.1"
|
||||||
Environment="ETCD_NAME=${etcd_name}"
|
Environment="ETCD_NAME=${etcd_name}"
|
||||||
Environment="ETCD_ADVERTISE_CLIENT_URLS=https://${etcd_domain}:2379"
|
Environment="ETCD_ADVERTISE_CLIENT_URLS=https://${etcd_domain}:2379"
|
||||||
Environment="ETCD_INITIAL_ADVERTISE_PEER_URLS=https://${etcd_domain}:2380"
|
Environment="ETCD_INITIAL_ADVERTISE_PEER_URLS=https://${etcd_domain}:2380"
|
||||||
@ -74,11 +74,9 @@ systemd:
|
|||||||
--volume var-log,kind=host,source=/var/log \
|
--volume var-log,kind=host,source=/var/log \
|
||||||
--mount volume=var-log,target=/var/log \
|
--mount volume=var-log,target=/var/log \
|
||||||
--insecure-options=image"
|
--insecure-options=image"
|
||||||
ExecStartPre=/bin/mkdir -p /opt/cni/bin
|
|
||||||
ExecStartPre=/bin/mkdir -p /etc/kubernetes/manifests
|
|
||||||
ExecStartPre=/bin/mkdir -p /etc/kubernetes/cni/net.d
|
ExecStartPre=/bin/mkdir -p /etc/kubernetes/cni/net.d
|
||||||
ExecStartPre=/bin/mkdir -p /etc/kubernetes/checkpoint-secrets
|
ExecStartPre=/bin/mkdir -p /etc/kubernetes/manifests
|
||||||
ExecStartPre=/bin/mkdir -p /etc/kubernetes/inactive-manifests
|
ExecStartPre=/bin/mkdir -p /opt/cni/bin
|
||||||
ExecStartPre=/bin/mkdir -p /var/lib/cni
|
ExecStartPre=/bin/mkdir -p /var/lib/cni
|
||||||
ExecStartPre=/bin/mkdir -p /var/lib/calico
|
ExecStartPre=/bin/mkdir -p /var/lib/calico
|
||||||
ExecStartPre=/bin/mkdir -p /var/lib/kubelet/volumeplugins
|
ExecStartPre=/bin/mkdir -p /var/lib/kubelet/volumeplugins
|
||||||
@ -97,8 +95,8 @@ systemd:
|
|||||||
--kubeconfig=/etc/kubernetes/kubeconfig \
|
--kubeconfig=/etc/kubernetes/kubeconfig \
|
||||||
--lock-file=/var/run/lock/kubelet.lock \
|
--lock-file=/var/run/lock/kubelet.lock \
|
||||||
--network-plugin=cni \
|
--network-plugin=cni \
|
||||||
--node-labels=node-role.kubernetes.io/master \
|
--node-labels=node.kubernetes.io/master \
|
||||||
--node-labels=node-role.kubernetes.io/controller="true" \
|
--node-labels=node.kubernetes.io/controller="true" \
|
||||||
--pod-manifest-path=/etc/kubernetes/manifests \
|
--pod-manifest-path=/etc/kubernetes/manifests \
|
||||||
--read-only-port=0 \
|
--read-only-port=0 \
|
||||||
--register-with-taints=node-role.kubernetes.io/master=:NoSchedule \
|
--register-with-taints=node-role.kubernetes.io/master=:NoSchedule \
|
||||||
@ -108,17 +106,28 @@ systemd:
|
|||||||
RestartSec=10
|
RestartSec=10
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
- name: bootkube.service
|
- name: bootstrap.service
|
||||||
contents: |
|
contents: |
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Bootstrap a Kubernetes cluster
|
Description=Kubernetes control plane
|
||||||
ConditionPathExists=!/opt/bootkube/init_bootkube.done
|
ConditionPathExists=!/opt/bootstrap/bootstrap.done
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
RemainAfterExit=true
|
RemainAfterExit=true
|
||||||
WorkingDirectory=/opt/bootkube
|
WorkingDirectory=/opt/bootstrap
|
||||||
ExecStart=/opt/bootkube/bootkube-start
|
ExecStartPre=-/usr/bin/bash -c 'set -x && [ -n "$(ls /opt/bootstrap/assets/manifests-*/* 2>/dev/null)" ] && mv /opt/bootstrap/assets/manifests-*/* /opt/bootstrap/assets/manifests && rm -rf /opt/bootstrap/assets/manifests-*'
|
||||||
ExecStartPost=/bin/touch /opt/bootkube/init_bootkube.done
|
ExecStart=/usr/bin/rkt run \
|
||||||
|
--trust-keys-from-https \
|
||||||
|
--volume assets,kind=host,source=/opt/bootstrap/assets \
|
||||||
|
--mount volume=assets,target=/assets \
|
||||||
|
--volume script,kind=host,source=/opt/bootstrap/apply \
|
||||||
|
--mount volume=script,target=/apply \
|
||||||
|
--insecure-options=image \
|
||||||
|
docker://k8s.gcr.io/hyperkube:v1.16.1 \
|
||||||
|
--net=host \
|
||||||
|
--dns=host \
|
||||||
|
--exec=/apply
|
||||||
|
ExecStartPost=/bin/touch /opt/bootstrap/bootstrap.done
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
storage:
|
storage:
|
||||||
@ -129,34 +138,24 @@ storage:
|
|||||||
contents:
|
contents:
|
||||||
inline: |
|
inline: |
|
||||||
KUBELET_IMAGE_URL=docker://k8s.gcr.io/hyperkube
|
KUBELET_IMAGE_URL=docker://k8s.gcr.io/hyperkube
|
||||||
KUBELET_IMAGE_TAG=v1.15.1
|
KUBELET_IMAGE_TAG=v1.16.1
|
||||||
|
- path: /opt/bootstrap/apply
|
||||||
|
filesystem: root
|
||||||
|
mode: 0544
|
||||||
|
contents:
|
||||||
|
inline: |
|
||||||
|
#!/bin/bash -e
|
||||||
|
export KUBECONFIG=/assets/auth/kubeconfig
|
||||||
|
until kubectl version; do
|
||||||
|
echo "Waiting for static pod control plane"
|
||||||
|
sleep 5
|
||||||
|
done
|
||||||
|
until kubectl apply -f /assets/manifests -R; do
|
||||||
|
echo "Retry applying manifests"
|
||||||
|
sleep 5
|
||||||
|
done
|
||||||
- path: /etc/sysctl.d/max-user-watches.conf
|
- path: /etc/sysctl.d/max-user-watches.conf
|
||||||
filesystem: root
|
filesystem: root
|
||||||
contents:
|
contents:
|
||||||
inline: |
|
inline: |
|
||||||
fs.inotify.max_user_watches=16184
|
fs.inotify.max_user_watches=16184
|
||||||
- path: /opt/bootkube/bootkube-start
|
|
||||||
filesystem: root
|
|
||||||
mode: 0544
|
|
||||||
user:
|
|
||||||
id: 500
|
|
||||||
group:
|
|
||||||
id: 500
|
|
||||||
contents:
|
|
||||||
inline: |
|
|
||||||
#!/bin/bash
|
|
||||||
# Wrapper for bootkube start
|
|
||||||
set -e
|
|
||||||
# Move experimental manifests
|
|
||||||
[ -n "$(ls /opt/bootkube/assets/manifests-*/* 2>/dev/null)" ] && mv /opt/bootkube/assets/manifests-*/* /opt/bootkube/assets/manifests && rm -rf /opt/bootkube/assets/manifests-*
|
|
||||||
exec /usr/bin/rkt run \
|
|
||||||
--trust-keys-from-https \
|
|
||||||
--volume assets,kind=host,source=/opt/bootkube/assets \
|
|
||||||
--mount volume=assets,target=/assets \
|
|
||||||
--volume bootstrap,kind=host,source=/etc/kubernetes \
|
|
||||||
--mount volume=bootstrap,target=/etc/kubernetes \
|
|
||||||
$${RKT_OPTS} \
|
|
||||||
quay.io/coreos/bootkube:v0.14.0 \
|
|
||||||
--net=host \
|
|
||||||
--dns=host \
|
|
||||||
--exec=/bootkube -- start --asset-dir=/assets "$@"
|
|
||||||
|
@ -49,9 +49,9 @@ systemd:
|
|||||||
--volume var-log,kind=host,source=/var/log \
|
--volume var-log,kind=host,source=/var/log \
|
||||||
--mount volume=var-log,target=/var/log \
|
--mount volume=var-log,target=/var/log \
|
||||||
--insecure-options=image"
|
--insecure-options=image"
|
||||||
ExecStartPre=/bin/mkdir -p /opt/cni/bin
|
|
||||||
ExecStartPre=/bin/mkdir -p /etc/kubernetes/manifests
|
|
||||||
ExecStartPre=/bin/mkdir -p /etc/kubernetes/cni/net.d
|
ExecStartPre=/bin/mkdir -p /etc/kubernetes/cni/net.d
|
||||||
|
ExecStartPre=/bin/mkdir -p /etc/kubernetes/manifests
|
||||||
|
ExecStartPre=/bin/mkdir -p /opt/cni/bin
|
||||||
ExecStartPre=/bin/mkdir -p /var/lib/cni
|
ExecStartPre=/bin/mkdir -p /var/lib/cni
|
||||||
ExecStartPre=/bin/mkdir -p /var/lib/calico
|
ExecStartPre=/bin/mkdir -p /var/lib/calico
|
||||||
ExecStartPre=/bin/mkdir -p /var/lib/kubelet/volumeplugins
|
ExecStartPre=/bin/mkdir -p /var/lib/kubelet/volumeplugins
|
||||||
@ -70,7 +70,7 @@ systemd:
|
|||||||
--kubeconfig=/etc/kubernetes/kubeconfig \
|
--kubeconfig=/etc/kubernetes/kubeconfig \
|
||||||
--lock-file=/var/run/lock/kubelet.lock \
|
--lock-file=/var/run/lock/kubelet.lock \
|
||||||
--network-plugin=cni \
|
--network-plugin=cni \
|
||||||
--node-labels=node-role.kubernetes.io/node \
|
--node-labels=node.kubernetes.io/node \
|
||||||
--pod-manifest-path=/etc/kubernetes/manifests \
|
--pod-manifest-path=/etc/kubernetes/manifests \
|
||||||
--read-only-port=0 \
|
--read-only-port=0 \
|
||||||
--volume-plugin-dir=/var/lib/kubelet/volumeplugins
|
--volume-plugin-dir=/var/lib/kubelet/volumeplugins
|
||||||
@ -99,7 +99,7 @@ storage:
|
|||||||
contents:
|
contents:
|
||||||
inline: |
|
inline: |
|
||||||
KUBELET_IMAGE_URL=docker://k8s.gcr.io/hyperkube
|
KUBELET_IMAGE_URL=docker://k8s.gcr.io/hyperkube
|
||||||
KUBELET_IMAGE_TAG=v1.15.1
|
KUBELET_IMAGE_TAG=v1.16.1
|
||||||
- path: /etc/sysctl.d/max-user-watches.conf
|
- path: /etc/sysctl.d/max-user-watches.conf
|
||||||
filesystem: root
|
filesystem: root
|
||||||
contents:
|
contents:
|
||||||
@ -117,7 +117,7 @@ storage:
|
|||||||
--volume config,kind=host,source=/etc/kubernetes \
|
--volume config,kind=host,source=/etc/kubernetes \
|
||||||
--mount volume=config,target=/etc/kubernetes \
|
--mount volume=config,target=/etc/kubernetes \
|
||||||
--insecure-options=image \
|
--insecure-options=image \
|
||||||
docker://k8s.gcr.io/hyperkube:v1.15.1 \
|
docker://k8s.gcr.io/hyperkube:v1.16.1 \
|
||||||
--net=host \
|
--net=host \
|
||||||
--dns=host \
|
--dns=host \
|
||||||
--exec=/kubectl -- --kubeconfig=/etc/kubernetes/kubeconfig delete node $(hostname)
|
--exec=/kubectl -- --kubeconfig=/etc/kubernetes/kubeconfig delete node $(hostname)
|
||||||
|
@ -53,24 +53,33 @@ resource "digitalocean_firewall" "controllers" {
|
|||||||
|
|
||||||
tags = ["${var.cluster_name}-controller"]
|
tags = ["${var.cluster_name}-controller"]
|
||||||
|
|
||||||
# etcd, kube-apiserver, kubelet
|
# etcd
|
||||||
inbound_rule {
|
inbound_rule {
|
||||||
protocol = "tcp"
|
protocol = "tcp"
|
||||||
port_range = "2379-2380"
|
port_range = "2379-2380"
|
||||||
source_tags = [digitalocean_tag.controllers.name]
|
source_tags = [digitalocean_tag.controllers.name]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# etcd metrics
|
||||||
inbound_rule {
|
inbound_rule {
|
||||||
protocol = "tcp"
|
protocol = "tcp"
|
||||||
port_range = "2381"
|
port_range = "2381"
|
||||||
source_tags = [digitalocean_tag.workers.name]
|
source_tags = [digitalocean_tag.workers.name]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# kube-apiserver
|
||||||
inbound_rule {
|
inbound_rule {
|
||||||
protocol = "tcp"
|
protocol = "tcp"
|
||||||
port_range = "6443"
|
port_range = "6443"
|
||||||
source_addresses = ["0.0.0.0/0", "::/0"]
|
source_addresses = ["0.0.0.0/0", "::/0"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# kube-scheduler metrics, kube-controller-manager metrics
|
||||||
|
inbound_rule {
|
||||||
|
protocol = "tcp"
|
||||||
|
port_range = "10251-10252"
|
||||||
|
source_tags = [digitalocean_tag.workers.name]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "digitalocean_firewall" "workers" {
|
resource "digitalocean_firewall" "workers" {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
output "kubeconfig-admin" {
|
output "kubeconfig-admin" {
|
||||||
value = module.bootkube.kubeconfig-admin
|
value = module.bootstrap.kubeconfig-admin
|
||||||
}
|
}
|
||||||
|
|
||||||
output "controllers_dns" {
|
output "controllers_dns" {
|
||||||
|
@ -1,57 +1,63 @@
|
|||||||
# Secure copy etcd TLS assets and kubeconfig to controllers. Activates kubelet.service
|
# Secure copy assets to controllers. Activates kubelet.service
|
||||||
resource "null_resource" "copy-controller-secrets" {
|
resource "null_resource" "copy-controller-secrets" {
|
||||||
count = var.controller_count
|
count = var.controller_count
|
||||||
|
|
||||||
depends_on = [
|
depends_on = [
|
||||||
|
module.bootstrap,
|
||||||
digitalocean_firewall.rules
|
digitalocean_firewall.rules
|
||||||
]
|
]
|
||||||
|
|
||||||
connection {
|
connection {
|
||||||
type = "ssh"
|
type = "ssh"
|
||||||
host = element(digitalocean_droplet.controllers.*.ipv4_address, count.index)
|
host = digitalocean_droplet.controllers.*.ipv4_address[count.index]
|
||||||
user = "core"
|
user = "core"
|
||||||
timeout = "15m"
|
timeout = "15m"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.kubeconfig-kubelet
|
content = module.bootstrap.kubeconfig-kubelet
|
||||||
destination = "$HOME/kubeconfig"
|
destination = "$HOME/kubeconfig"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.etcd_ca_cert
|
content = module.bootstrap.etcd_ca_cert
|
||||||
destination = "$HOME/etcd-client-ca.crt"
|
destination = "$HOME/etcd-client-ca.crt"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.etcd_client_cert
|
content = module.bootstrap.etcd_client_cert
|
||||||
destination = "$HOME/etcd-client.crt"
|
destination = "$HOME/etcd-client.crt"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.etcd_client_key
|
content = module.bootstrap.etcd_client_key
|
||||||
destination = "$HOME/etcd-client.key"
|
destination = "$HOME/etcd-client.key"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.etcd_server_cert
|
content = module.bootstrap.etcd_server_cert
|
||||||
destination = "$HOME/etcd-server.crt"
|
destination = "$HOME/etcd-server.crt"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.etcd_server_key
|
content = module.bootstrap.etcd_server_key
|
||||||
destination = "$HOME/etcd-server.key"
|
destination = "$HOME/etcd-server.key"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.etcd_peer_cert
|
content = module.bootstrap.etcd_peer_cert
|
||||||
destination = "$HOME/etcd-peer.crt"
|
destination = "$HOME/etcd-peer.crt"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.etcd_peer_key
|
content = module.bootstrap.etcd_peer_key
|
||||||
destination = "$HOME/etcd-peer.key"
|
destination = "$HOME/etcd-peer.key"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
provisioner "file" {
|
||||||
|
source = var.asset_dir
|
||||||
|
destination = "$HOME/assets"
|
||||||
|
}
|
||||||
|
|
||||||
provisioner "remote-exec" {
|
provisioner "remote-exec" {
|
||||||
inline = [
|
inline = [
|
||||||
@ -65,7 +71,13 @@ resource "null_resource" "copy-controller-secrets" {
|
|||||||
"sudo mv etcd-peer.key /etc/ssl/etcd/etcd/peer.key",
|
"sudo mv etcd-peer.key /etc/ssl/etcd/etcd/peer.key",
|
||||||
"sudo chown -R etcd:etcd /etc/ssl/etcd",
|
"sudo chown -R etcd:etcd /etc/ssl/etcd",
|
||||||
"sudo chmod -R 500 /etc/ssl/etcd",
|
"sudo chmod -R 500 /etc/ssl/etcd",
|
||||||
|
"sudo mv $HOME/assets /opt/bootstrap/assets",
|
||||||
|
"sudo mkdir -p /etc/kubernetes/manifests",
|
||||||
|
"sudo mkdir -p /etc/kubernetes/bootstrap-secrets",
|
||||||
"sudo mv $HOME/kubeconfig /etc/kubernetes/kubeconfig",
|
"sudo mv $HOME/kubeconfig /etc/kubernetes/kubeconfig",
|
||||||
|
"sudo cp -r /opt/bootstrap/assets/tls/* /etc/kubernetes/bootstrap-secrets/",
|
||||||
|
"sudo cp /opt/bootstrap/assets/auth/kubeconfig /etc/kubernetes/bootstrap-secrets/",
|
||||||
|
"sudo cp -r /opt/bootstrap/assets/static-manifests/* /etc/kubernetes/manifests/",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -76,13 +88,13 @@ resource "null_resource" "copy-worker-secrets" {
|
|||||||
|
|
||||||
connection {
|
connection {
|
||||||
type = "ssh"
|
type = "ssh"
|
||||||
host = element(digitalocean_droplet.workers.*.ipv4_address, count.index)
|
host = digitalocean_droplet.workers.*.ipv4_address[count.index]
|
||||||
user = "core"
|
user = "core"
|
||||||
timeout = "15m"
|
timeout = "15m"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
content = module.bootkube.kubeconfig-kubelet
|
content = module.bootstrap.kubeconfig-kubelet
|
||||||
destination = "$HOME/kubeconfig"
|
destination = "$HOME/kubeconfig"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,11 +105,9 @@ resource "null_resource" "copy-worker-secrets" {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Secure copy bootkube assets to ONE controller and start bootkube to perform
|
# Connect to a controller to perform one-time cluster bootstrap.
|
||||||
# one-time self-hosted cluster bootstrapping.
|
resource "null_resource" "bootstrap" {
|
||||||
resource "null_resource" "bootkube-start" {
|
|
||||||
depends_on = [
|
depends_on = [
|
||||||
module.bootkube,
|
|
||||||
null_resource.copy-controller-secrets,
|
null_resource.copy-controller-secrets,
|
||||||
null_resource.copy-worker-secrets,
|
null_resource.copy-worker-secrets,
|
||||||
]
|
]
|
||||||
@ -109,15 +119,9 @@ resource "null_resource" "bootkube-start" {
|
|||||||
timeout = "15m"
|
timeout = "15m"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
|
||||||
source = var.asset_dir
|
|
||||||
destination = "$HOME/assets"
|
|
||||||
}
|
|
||||||
|
|
||||||
provisioner "remote-exec" {
|
provisioner "remote-exec" {
|
||||||
inline = [
|
inline = [
|
||||||
"sudo mv $HOME/assets /opt/bootkube",
|
"sudo systemctl start bootstrap",
|
||||||
"sudo systemctl start bootkube",
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,33 +18,33 @@ variable "dns_zone" {
|
|||||||
# instances
|
# instances
|
||||||
|
|
||||||
variable "controller_count" {
|
variable "controller_count" {
|
||||||
type = string
|
type = number
|
||||||
default = "1"
|
|
||||||
description = "Number of controllers (i.e. masters)"
|
description = "Number of controllers (i.e. masters)"
|
||||||
|
default = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "worker_count" {
|
variable "worker_count" {
|
||||||
type = string
|
type = number
|
||||||
default = "1"
|
|
||||||
description = "Number of workers"
|
description = "Number of workers"
|
||||||
|
default = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "controller_type" {
|
variable "controller_type" {
|
||||||
type = string
|
type = string
|
||||||
default = "s-2vcpu-2gb"
|
|
||||||
description = "Droplet type for controllers (e.g. s-2vcpu-2gb, s-2vcpu-4gb, s-4vcpu-8gb)."
|
description = "Droplet type for controllers (e.g. s-2vcpu-2gb, s-2vcpu-4gb, s-4vcpu-8gb)."
|
||||||
|
default = "s-2vcpu-2gb"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "worker_type" {
|
variable "worker_type" {
|
||||||
type = string
|
type = string
|
||||||
default = "s-1vcpu-2gb"
|
|
||||||
description = "Droplet type for workers (e.g. s-1vcpu-2gb, s-2vcpu-2gb)"
|
description = "Droplet type for workers (e.g. s-1vcpu-2gb, s-2vcpu-2gb)"
|
||||||
|
default = "s-1vcpu-2gb"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "image" {
|
variable "image" {
|
||||||
type = string
|
type = string
|
||||||
default = "coreos-stable"
|
|
||||||
description = "Container Linux image for instances (e.g. coreos-stable)"
|
description = "Container Linux image for instances (e.g. coreos-stable)"
|
||||||
|
default = "coreos-stable"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "controller_clc_snippets" {
|
variable "controller_clc_snippets" {
|
||||||
@ -67,48 +67,48 @@ variable "ssh_fingerprints" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
variable "asset_dir" {
|
variable "asset_dir" {
|
||||||
description = "Path to a directory where generated assets should be placed (contains secrets)"
|
|
||||||
type = string
|
type = string
|
||||||
|
description = "Absolute path to a directory where generated assets should be placed (contains secrets)"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "networking" {
|
variable "networking" {
|
||||||
description = "Choice of networking provider (flannel or calico)"
|
|
||||||
type = string
|
type = string
|
||||||
|
description = "Choice of networking provider (flannel or calico)"
|
||||||
default = "flannel"
|
default = "flannel"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "pod_cidr" {
|
variable "pod_cidr" {
|
||||||
description = "CIDR IPv4 range to assign Kubernetes pods"
|
|
||||||
type = string
|
type = string
|
||||||
|
description = "CIDR IPv4 range to assign Kubernetes pods"
|
||||||
default = "10.2.0.0/16"
|
default = "10.2.0.0/16"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "service_cidr" {
|
variable "service_cidr" {
|
||||||
|
type = string
|
||||||
description = <<EOD
|
description = <<EOD
|
||||||
CIDR IPv4 range to assign Kubernetes services.
|
CIDR IPv4 range to assign Kubernetes services.
|
||||||
The 1st IP will be reserved for kube_apiserver, the 10th IP will be reserved for coredns.
|
The 1st IP will be reserved for kube_apiserver, the 10th IP will be reserved for coredns.
|
||||||
EOD
|
EOD
|
||||||
|
|
||||||
|
|
||||||
type = string
|
|
||||||
default = "10.3.0.0/16"
|
default = "10.3.0.0/16"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "cluster_domain_suffix" {
|
|
||||||
description = "Queries for domains with the suffix will be answered by coredns. Default is cluster.local (e.g. foo.default.svc.cluster.local) "
|
|
||||||
type = string
|
|
||||||
default = "cluster.local"
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "enable_reporting" {
|
variable "enable_reporting" {
|
||||||
type = string
|
type = bool
|
||||||
description = "Enable usage or analytics reporting to upstreams (Calico)"
|
description = "Enable usage or analytics reporting to upstreams (Calico)"
|
||||||
default = "false"
|
default = false
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "enable_aggregation" {
|
variable "enable_aggregation" {
|
||||||
|
type = bool
|
||||||
description = "Enable the Kubernetes Aggregation Layer (defaults to false)"
|
description = "Enable the Kubernetes Aggregation Layer (defaults to false)"
|
||||||
type = string
|
default = false
|
||||||
default = "false"
|
}
|
||||||
|
|
||||||
|
# unofficial, undocumented, unsupported
|
||||||
|
|
||||||
|
variable "cluster_domain_suffix" {
|
||||||
|
type = string
|
||||||
|
description = "Queries for domains with the suffix will be answered by coredns. Default is cluster.local (e.g. foo.default.svc.cluster.local) "
|
||||||
|
default = "cluster.local"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ resource "google_dns_record_set" "some-application" {
|
|||||||
|
|
||||||
## Digital Ocean
|
## Digital Ocean
|
||||||
|
|
||||||
On Digital Ocean, DNS A and AAAA records (e.g. FQDN `nemo-workers.example.com`) resolve to each worker[^1] running an Ingress controller DaemonSet on host ports 80 and 443. Firewall rules allow IPv4 and IPv6 traffic to ports 80 and 443.
|
On DigitalOcean, DNS A and AAAA records (e.g. FQDN `nemo-workers.example.com`) resolve to each worker[^1] running an Ingress controller DaemonSet on host ports 80 and 443. Firewall rules allow IPv4 and IPv6 traffic to ports 80 and 443.
|
||||||
|
|
||||||
Create the Ingress controller daemonset, service, RBAC roles, RBAC bindings, and namespace.
|
Create the Ingress controller daemonset, service, RBAC roles, RBAC bindings, and namespace.
|
||||||
|
|
||||||
@ -127,7 +127,7 @@ resource "google_dns_record_set" "some-application" {
|
|||||||
!!! note
|
!!! note
|
||||||
Hosting IPv6 apps is possible, but requires editing the nginx-ingress addon to use `hostNetwork: true`.
|
Hosting IPv6 apps is possible, but requires editing the nginx-ingress addon to use `hostNetwork: true`.
|
||||||
|
|
||||||
[^1]: Digital Ocean does offer load balancers. We've opted not to use them to keep the Digital Ocean setup simple and cheap for developers.
|
[^1]: DigitalOcean does offer load balancers. We've opted not to use them to keep the DigitalOcean cluster cheap for developers.
|
||||||
|
|
||||||
## Google Cloud
|
## Google Cloud
|
||||||
|
|
||||||
|
@ -147,5 +147,5 @@ module "digital-ocean-nemo" {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
To customize lower-level Kubernetes control plane bootstrapping, see the [poseidon/terraform-render-bootkube](https://github.com/poseidon/terraform-render-bootkube) Terraform module.
|
To customize low-level Kubernetes control plane bootstrapping, see the [poseidon/terraform-render-bootstrap](https://github.com/poseidon/terraform-render-bootstrap) Terraform module.
|
||||||
|
|
||||||
|
@ -62,11 +62,14 @@ The AWS internal `workers` module supports a number of [variables](https://githu
|
|||||||
|:-----|:------------|:--------|:--------|
|
|:-----|:------------|:--------|:--------|
|
||||||
| worker_count | Number of instances | 1 | 3 |
|
| worker_count | Number of instances | 1 | 3 |
|
||||||
| instance_type | EC2 instance type | "t3.small" | "t3.medium" |
|
| instance_type | EC2 instance type | "t3.small" | "t3.medium" |
|
||||||
| os_image | AMI channel for a Container Linux derivative | coreos-stable | coreos-stable, coreos-beta, coreos-alpha, flatcar-stable, flatcar-beta, flatcar-alpha |
|
| os_image | AMI channel for a Container Linux derivative | "coreos-stable" | coreos-stable, coreos-beta, coreos-alpha, flatcar-stable, flatcar-beta, flatcar-alpha |
|
||||||
| disk_size | Size of the disk in GB | 40 | 100 |
|
| disk_size | Size of the EBS volume in GB | 40 | 100 |
|
||||||
| spot_price | Spot price in USD for workers. Leave as default empty string for regular on-demand instances | "" | "0.10" |
|
| disk_type | Type of the EBS volume | "gp2" | standard, gp2, io1 |
|
||||||
|
| disk_iops | IOPS of the EBS volume | 0 (i.e. auto) | 400 |
|
||||||
|
| spot_price | Spot price in USD for worker instances or 0 to use on-demand instances | 0 | 0.10 |
|
||||||
|
| clc_snippets | Container Linux Config snippets | [] | [example](/advanced/customization/#usage) |
|
||||||
| service_cidr | Must match `service_cidr` of cluster | "10.3.0.0/16" | "10.3.0.0/24" |
|
| service_cidr | Must match `service_cidr` of cluster | "10.3.0.0/16" | "10.3.0.0/24" |
|
||||||
| cluster_domain_suffix | Must match `cluster_domain_suffix` of cluster | "cluster.local" | "k8s.example.com" |
|
| node_labels | List of initial node labels | [] | ["worker-pool=foo"] |
|
||||||
|
|
||||||
Check the list of valid [instance types](https://aws.amazon.com/ec2/instance-types/) or per-region and per-type [spot prices](https://aws.amazon.com/ec2/spot/pricing/).
|
Check the list of valid [instance types](https://aws.amazon.com/ec2/instance-types/) or per-region and per-type [spot prices](https://aws.amazon.com/ec2/spot/pricing/).
|
||||||
|
|
||||||
@ -76,7 +79,7 @@ Create a cluster following the Azure [tutorial](../cl/azure.md#cluster). Define
|
|||||||
|
|
||||||
```tf
|
```tf
|
||||||
module "ramius-worker-pool" {
|
module "ramius-worker-pool" {
|
||||||
source = "git::https://github.com/poseidon/typhoon//azure/container-linux/kubernetes/workers?ref=v1.15.1"
|
source = "git::https://github.com/poseidon/typhoon//azure/container-linux/kubernetes/workers?ref=v1.16.1"
|
||||||
|
|
||||||
# Azure
|
# Azure
|
||||||
region = module.azure-ramius.region
|
region = module.azure-ramius.region
|
||||||
@ -127,12 +130,12 @@ The Azure internal `workers` module supports a number of [variables](https://git
|
|||||||
| Name | Description | Default | Example |
|
| Name | Description | Default | Example |
|
||||||
|:-----|:------------|:--------|:--------|
|
|:-----|:------------|:--------|:--------|
|
||||||
| worker_count | Number of instances | 1 | 3 |
|
| worker_count | Number of instances | 1 | 3 |
|
||||||
| vm_type | Machine type for instances | "Standard_F1" | See below |
|
| vm_type | Machine type for instances | "Standard_DS1_v2" | See below |
|
||||||
| os_image | Channel for a Container Linux derivative | coreos-stable | coreos-stable, coreos-beta, coreos-alpha |
|
| os_image | Channel for a Container Linux derivative | "coreos-stable" | coreos-stable, coreos-beta, coreos-alpha |
|
||||||
| priority | Set priority to Low to use reduced cost surplus capacity, with the tradeoff that instances can be deallocated at any time | Regular | Low |
|
| priority | Set priority to Low to use reduced cost surplus capacity, with the tradeoff that instances can be deallocated at any time | "Regular" | "Low" |
|
||||||
| clc_snippets | Container Linux Config snippets | [] | [example](/advanced/customization/#usage) |
|
| clc_snippets | Container Linux Config snippets | [] | [example](/advanced/customization/#usage) |
|
||||||
| service_cidr | CIDR IPv4 range to assign to Kubernetes services | "10.3.0.0/16" | "10.3.0.0/24" |
|
| service_cidr | CIDR IPv4 range to assign to Kubernetes services | "10.3.0.0/16" | "10.3.0.0/24" |
|
||||||
| cluster_domain_suffix | FQDN suffix for Kubernetes services answered by coredns. | "cluster.local" | "k8s.example.com" |
|
| node_labels | List of initial node labels | [] | ["worker-pool=foo"] |
|
||||||
|
|
||||||
Check the list of valid [machine types](https://azure.microsoft.com/en-us/pricing/details/virtual-machines/linux/) and their [specs](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/sizes-general). Use `az vm list-skus` to get the identifier.
|
Check the list of valid [machine types](https://azure.microsoft.com/en-us/pricing/details/virtual-machines/linux/) and their [specs](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/sizes-general). Use `az vm list-skus` to get the identifier.
|
||||||
|
|
||||||
@ -142,7 +145,7 @@ Create a cluster following the Google Cloud [tutorial](../cl/google-cloud.md#clu
|
|||||||
|
|
||||||
```tf
|
```tf
|
||||||
module "yavin-worker-pool" {
|
module "yavin-worker-pool" {
|
||||||
source = "git::https://github.com/poseidon/typhoon//google-cloud/container-linux/kubernetes/workers?ref=v1.15.1"
|
source = "git::https://github.com/poseidon/typhoon//google-cloud/container-linux/kubernetes/workers?ref=v1.16.1"
|
||||||
|
|
||||||
# Google Cloud
|
# Google Cloud
|
||||||
region = "europe-west2"
|
region = "europe-west2"
|
||||||
@ -173,11 +176,11 @@ Verify a managed instance group of workers joins the cluster within a few minute
|
|||||||
```
|
```
|
||||||
$ kubectl get nodes
|
$ kubectl get nodes
|
||||||
NAME STATUS AGE VERSION
|
NAME STATUS AGE VERSION
|
||||||
yavin-controller-0.c.example-com.internal Ready 6m v1.15.1
|
yavin-controller-0.c.example-com.internal Ready 6m v1.16.1
|
||||||
yavin-worker-jrbf.c.example-com.internal Ready 5m v1.15.1
|
yavin-worker-jrbf.c.example-com.internal Ready 5m v1.16.1
|
||||||
yavin-worker-mzdm.c.example-com.internal Ready 5m v1.15.1
|
yavin-worker-mzdm.c.example-com.internal Ready 5m v1.16.1
|
||||||
yavin-16x-worker-jrbf.c.example-com.internal Ready 3m v1.15.1
|
yavin-16x-worker-jrbf.c.example-com.internal Ready 3m v1.16.1
|
||||||
yavin-16x-worker-mzdm.c.example-com.internal Ready 3m v1.15.1
|
yavin-16x-worker-mzdm.c.example-com.internal Ready 3m v1.16.1
|
||||||
```
|
```
|
||||||
|
|
||||||
### Variables
|
### Variables
|
||||||
@ -189,9 +192,9 @@ The Google Cloud internal `workers` module supports a number of [variables](http
|
|||||||
| Name | Description | Example |
|
| Name | Description | Example |
|
||||||
|:-----|:------------|:--------|
|
|:-----|:------------|:--------|
|
||||||
| name | Unique name (distinct from cluster name) | "yavin-16x" |
|
| name | Unique name (distinct from cluster name) | "yavin-16x" |
|
||||||
|
| cluster_name | Must be set to `cluster_name` of cluster | "yavin" |
|
||||||
| region | Region for the worker pool instances. May differ from the cluster's region | "europe-west2" |
|
| region | Region for the worker pool instances. May differ from the cluster's region | "europe-west2" |
|
||||||
| network | Must be set to `network_name` output by cluster | module.cluster.network_name |
|
| network | Must be set to `network_name` output by cluster | module.cluster.network_name |
|
||||||
| cluster_name | Must be set to `cluster_name` of cluster | "yavin" |
|
|
||||||
| kubeconfig | Must be set to `kubeconfig` output by cluster | module.cluster.kubeconfig |
|
| kubeconfig | Must be set to `kubeconfig` output by cluster | module.cluster.kubeconfig |
|
||||||
| ssh_authorized_key | SSH public key for user 'core' | "ssh-rsa AAAAB3NZ..." |
|
| ssh_authorized_key | SSH public key for user 'core' | "ssh-rsa AAAAB3NZ..." |
|
||||||
|
|
||||||
@ -206,8 +209,9 @@ Check the list of regions [docs](https://cloud.google.com/compute/docs/regions-z
|
|||||||
| os_image | Container Linux image for compute instances | "coreos-stable" | "coreos-alpha", "coreos-beta" |
|
| os_image | Container Linux image for compute instances | "coreos-stable" | "coreos-alpha", "coreos-beta" |
|
||||||
| disk_size | Size of the disk in GB | 40 | 100 |
|
| disk_size | Size of the disk in GB | 40 | 100 |
|
||||||
| preemptible | If true, Compute Engine will terminate instances randomly within 24 hours | false | true |
|
| preemptible | If true, Compute Engine will terminate instances randomly within 24 hours | false | true |
|
||||||
|
| clc_snippets | Container Linux Config snippets | [] | [example](/advanced/customization/#usage) |
|
||||||
| service_cidr | Must match `service_cidr` of cluster | "10.3.0.0/16" | "10.3.0.0/24" |
|
| service_cidr | Must match `service_cidr` of cluster | "10.3.0.0/16" | "10.3.0.0/24" |
|
||||||
| cluster_domain_suffix | Must match `cluster_domain_suffix` of cluster | "cluster.local" | "k8s.example.com" |
|
| node_labels | List of initial node labels | [] | ["worker-pool=foo"] |
|
||||||
|
|
||||||
Check the list of valid [machine types](https://cloud.google.com/compute/docs/machine-types).
|
Check the list of valid [machine types](https://cloud.google.com/compute/docs/machine-types).
|
||||||
|
|
||||||
|
@ -1,8 +1,87 @@
|
|||||||
# AWS
|
# AWS
|
||||||
|
|
||||||
|
## Load Balancing
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### kube-apiserver
|
||||||
|
|
||||||
|
A network load balancer (NLB) distributes IPv4 TCP/6443 traffic across a target group of controller nodes with a healthy `kube-apiserver`. Clusters with multiple controllers span zones in a region to tolerate zone outages.
|
||||||
|
|
||||||
|
### HTTP/HTTPS Ingress
|
||||||
|
|
||||||
|
A network load balancer (NLB) distributes IPv4 TCP/80 and TCP/443 traffic across two target groups of worker nodes with a healthy Ingress controller. Workers span the zones in a region to tolerate zone outages.
|
||||||
|
|
||||||
|
The AWS NLB has a DNS alias record (regional) resolving to 3 zonal IPv4 addresses. The alias record is output as `ingress_dns_name` for use in application DNS CNAME records. See [Ingress on AWS](/addons/ingress/#aws).
|
||||||
|
|
||||||
|
### TCP Services
|
||||||
|
|
||||||
|
Load balance TCP applications by adding a listener and target group. A listener and target group may map different ports (e.g 3333 external, 30333 internal).
|
||||||
|
|
||||||
|
```tf
|
||||||
|
# Forward TCP traffic to a target group
|
||||||
|
resource "aws_lb_listener" "some-app" {
|
||||||
|
load_balancer_arn = module.tempest.nlb_id
|
||||||
|
protocol = "TCP"
|
||||||
|
port = "3333"
|
||||||
|
|
||||||
|
default_action {
|
||||||
|
type = "forward"
|
||||||
|
target_group_arn = aws_lb_target_group.some-app.arn
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Target group of workers for some-app
|
||||||
|
resource "aws_lb_target_group" "some-app" {
|
||||||
|
name = "some-app"
|
||||||
|
vpc_id = module.tempest.vpc_id
|
||||||
|
target_type = "instance"
|
||||||
|
|
||||||
|
protocol = "TCP"
|
||||||
|
port = 3333
|
||||||
|
|
||||||
|
health_check {
|
||||||
|
protocol = "TCP"
|
||||||
|
port = 30333
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Pass `worker_target_groups` to the cluster to register worker instances into custom target groups.
|
||||||
|
|
||||||
|
```tf
|
||||||
|
module "tempest" {
|
||||||
|
...
|
||||||
|
worker_target_groups = [
|
||||||
|
aws_lb_target_group.some-app.id,
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
* AWS NLBs and target groups do not support UDP
|
||||||
|
* Global Accelerator does support UDP, but its expensive
|
||||||
|
|
||||||
|
## Firewalls
|
||||||
|
|
||||||
|
Add firewall rules to the worker security group.
|
||||||
|
|
||||||
|
```tf
|
||||||
|
resource "aws_security_group_rule" "some-app" {
|
||||||
|
security_group_id = module.tempest.worker_security_groups[0]
|
||||||
|
|
||||||
|
type = "ingress"
|
||||||
|
protocol = "tcp"
|
||||||
|
from_port = 3333
|
||||||
|
to_port = 30333
|
||||||
|
cidr_blocks = ["0.0.0.0/0"]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## IPv6
|
## IPv6
|
||||||
|
|
||||||
Status of IPv6 on Typhoon AWS clusters.
|
AWS Network Load Balancers do not support `dualstack`.
|
||||||
|
|
||||||
| IPv6 Feature | Supported |
|
| IPv6 Feature | Supported |
|
||||||
|-------------------------|-----------|
|
|-------------------------|-----------|
|
||||||
@ -10,4 +89,3 @@ Status of IPv6 on Typhoon AWS clusters.
|
|||||||
| Node Outbound IPv6 | Yes |
|
| Node Outbound IPv6 | Yes |
|
||||||
| Kubernetes Ingress IPv6 | No |
|
| Kubernetes Ingress IPv6 | No |
|
||||||
|
|
||||||
* AWS Network Load Balancers do not support `dualstack`.
|
|
||||||
|
@ -1,13 +1,77 @@
|
|||||||
# Azure
|
# Azure
|
||||||
|
|
||||||
|
## Load Balancing
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### kube-apiserver
|
||||||
|
|
||||||
|
A load balancer distributes IPv4 TCP/6443 traffic across a backend address pool of controllers with a healthy `kube-apiserver`. Clusters with multiple controllers use an availability set with 2 fault domains to tolerate hardware failures within Azure.
|
||||||
|
|
||||||
|
### HTTP/HTTPS Ingress
|
||||||
|
|
||||||
|
A load balancer distributes IPv4 TCP/80 and TCP/443 traffic across a backend address pool of workers with a healthy Ingress controller.
|
||||||
|
|
||||||
|
The Azure LB IPv4 address is output as `ingress_static_ipv4` for use in DNS A records. See [Ingress on Azure](/addons/ingress/#azure).
|
||||||
|
|
||||||
|
### TCP/UDP Services
|
||||||
|
|
||||||
|
Load balance TCP/UDP applications by adding rules to the Azure LB (output). A rule may map different ports (e.g. 3333 external, 30333 internal).
|
||||||
|
|
||||||
|
```tf
|
||||||
|
# Forward traffic to the worker backend address pool
|
||||||
|
resource "azurerm_lb_rule" "some-app-tcp" {
|
||||||
|
resource_group_name = module.ramius.resource_group_name
|
||||||
|
|
||||||
|
name = "some-app-tcp"
|
||||||
|
loadbalancer_id = module.ramius.loadbalancer_id
|
||||||
|
frontend_ip_configuration_name = "ingress"
|
||||||
|
|
||||||
|
protocol = "Tcp"
|
||||||
|
frontend_port = 3333
|
||||||
|
backend_port = 30333
|
||||||
|
backend_address_pool_id = module.ramius.backend_address_pool_id
|
||||||
|
probe_id = azurerm_lb_probe.some-app.id
|
||||||
|
}
|
||||||
|
|
||||||
|
# Health check some-app
|
||||||
|
resource "azurerm_lb_probe" "some-app" {
|
||||||
|
resource_group_name = module.ramius.resource_group_name
|
||||||
|
|
||||||
|
name = "some-app"
|
||||||
|
loadbalancer_id = module.ramius.loadbalancer_id
|
||||||
|
protocol = "Tcp"
|
||||||
|
port = 30333
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Firewalls
|
||||||
|
|
||||||
|
Add firewall rules to the worker security group.
|
||||||
|
|
||||||
|
```tf
|
||||||
|
resource "azurerm_network_security_rule" "some-app" {
|
||||||
|
resource_group_name = "${module.ramius.resource_group_name}"
|
||||||
|
|
||||||
|
name = "some-app"
|
||||||
|
network_security_group_name = module.ramius.worker_security_group_name
|
||||||
|
priority = "3001"
|
||||||
|
access = "Allow"
|
||||||
|
direction = "Inbound"
|
||||||
|
protocol = "Tcp"
|
||||||
|
source_port_range = "*"
|
||||||
|
destination_port_range = "30333"
|
||||||
|
source_address_prefix = "*"
|
||||||
|
destination_address_prefix = module.ramius.worker_address_prefix
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## IPv6
|
## IPv6
|
||||||
|
|
||||||
Status of IPv6 on Typhoon Azure clusters.
|
Azure does not provide public IPv6 addresses at the standard SKU.
|
||||||
|
|
||||||
| IPv6 Feature | Supported |
|
| IPv6 Feature | Supported |
|
||||||
|-------------------------|-----------|
|
|-------------------------|-----------|
|
||||||
| Node IPv6 address | No |
|
| Node IPv6 address | No |
|
||||||
| Node Outbound IPv6 | No |
|
| Node Outbound IPv6 | No |
|
||||||
| Kubernetes Ingress IPv6 | No |
|
| Kubernetes Ingress IPv6 | No |
|
||||||
|
|
||||||
* Azure does not allow reserving a static IPv6 address
|
|
||||||
|
@ -1,5 +1,21 @@
|
|||||||
# Bare-Metal
|
# Bare-Metal
|
||||||
|
|
||||||
|
## Load Balancing
|
||||||
|
|
||||||
|
### kube-apiserver
|
||||||
|
|
||||||
|
Load balancing across controller nodes with a healthy `kube-apiserver` is determined by your unique bare-metal environment and its capabilities.
|
||||||
|
|
||||||
|
### HTTP/HTTPS Ingress
|
||||||
|
|
||||||
|
Load balancing across worker nodes with a healthy Ingress Controller is determined by your unique bare-metal environment and its capabilities.
|
||||||
|
|
||||||
|
See the `nginx-ingress` addon to run [Nginx as the Ingress Controller](/addons/ingress/#bare-metal) for bare-metal.
|
||||||
|
|
||||||
|
### TCP/UDP Services
|
||||||
|
|
||||||
|
Load balancing across worker nodes with TCP/UDP services is determined by your unique bare-metal environment and its capabilities.
|
||||||
|
|
||||||
## IPv6
|
## IPv6
|
||||||
|
|
||||||
Status of IPv6 on Typhoon bare-metal clusters.
|
Status of IPv6 on Typhoon bare-metal clusters.
|
||||||
|
@ -1,11 +1,92 @@
|
|||||||
# DigitalOcean
|
# DigitalOcean
|
||||||
|
|
||||||
|
## Load Balancing
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### kube-apiserver
|
||||||
|
|
||||||
|
DNS A records round-robin[^1] resolve IPv4 TCP/6443 traffic to controller droplets (regardless of whether their `kube-apiserver` is healthy). Clusters with multiple controllers are supported, but round-robin means 1/3 down causes ~1/3 of apiserver requests will fail).
|
||||||
|
|
||||||
|
[^1]: DigitalOcean does offer load balancers. We've opted not to use them to keep the DigitalOcean cluster cheap for developers.
|
||||||
|
|
||||||
|
### HTTP/HTTPS Ingress
|
||||||
|
|
||||||
|
DNS records (A and AAAA) round-robin[^1] resolve the `workers_dns` name (e.g. `nemo-workers.example.com`) to a worker droplet's IPv4 and IPv6 address. This allows running an Ingress controller Daemonset across workers (resolved regardless of whether its the controller is healthy).
|
||||||
|
|
||||||
|
The DNS record name is output as `workers_dns` for use in application DNS CNAME records. See [Ingess on DigitalOcean](/addons/ingress/#digital-ocean).
|
||||||
|
|
||||||
|
### TCP/UDP Services
|
||||||
|
|
||||||
|
DNS records (A and AAAA) round-robin[^1] resolve the `workers_dns` name (e.g. `nemo-workers.example.com`) to a worker droplet's IPv4 and IPv6 address. The DNS record name is output as `workers_dns` for use in application DNS CNAME records.
|
||||||
|
|
||||||
|
With round-robin as "load balancing", TCP/UDP services can be served via the same CNAME. Don't forget to add a firewall rule for the application.
|
||||||
|
|
||||||
|
### Custom Load Balancer
|
||||||
|
|
||||||
|
Add a DigitalOcean load balancer to distribute IPv4 TCP traffic (HTTP/HTTPS Ingress or TCP service) across worker droplets (tagged with `worker_tag`) with a healthy Ingress controller. A load balancer adds cost, but adds redundancy against worker failures (closer to Typhoon clusters on other platforms).
|
||||||
|
|
||||||
|
```tf
|
||||||
|
resource "digitalocean_loadbalancer" "ingress" {
|
||||||
|
name = "ingress"
|
||||||
|
region = "fra1"
|
||||||
|
droplet_tag = module.nemo.worker_tag
|
||||||
|
|
||||||
|
healthcheck {
|
||||||
|
protocol = "http"
|
||||||
|
port = "10254"
|
||||||
|
path = "/healthz"
|
||||||
|
healthy_threshold = 2
|
||||||
|
}
|
||||||
|
|
||||||
|
forwarding_rule {
|
||||||
|
entry_protocol = "tcp"
|
||||||
|
entry_port = 80
|
||||||
|
target_protocol = "tcp"
|
||||||
|
target_port = 80
|
||||||
|
}
|
||||||
|
|
||||||
|
forwarding_rule {
|
||||||
|
entry_protocol = "tcp"
|
||||||
|
entry_port = 443
|
||||||
|
target_protocol = "tcp"
|
||||||
|
target_port = 443
|
||||||
|
}
|
||||||
|
|
||||||
|
forwarding_rule {
|
||||||
|
entry_protocol = "tcp"
|
||||||
|
entry_port = 3333
|
||||||
|
target_protocol = "tcp"
|
||||||
|
target_port = 30300
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Define DNS A records to `digitalocean_loadbalancer.ingress.ip` instead of CNAMEs.
|
||||||
|
|
||||||
|
## Firewalls
|
||||||
|
|
||||||
|
Add firewall rules matching worker droplets with `worker_tag`.
|
||||||
|
|
||||||
|
```tf
|
||||||
|
resource "digitalocean_firewall" "some-app" {
|
||||||
|
name = "some-app"
|
||||||
|
tags = [module.nemo.worker_tag]
|
||||||
|
inbound_rule {
|
||||||
|
protocol = "tcp"
|
||||||
|
port_range = "30300"
|
||||||
|
source_addresses = ["0.0.0.0/0"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## IPv6
|
## IPv6
|
||||||
|
|
||||||
Status of IPv6 on Typhoon DigitalOcean clusters.
|
DigitalOcean load balancers do not have an IPv6 address. Resolving individual droplets' IPv6 addresses and using an Ingress controller with `hostNetwork: true` is a possible way to serve IPv6 traffic, if one must.
|
||||||
|
|
||||||
| IPv6 Feature | Supported |
|
| IPv6 Feature | Supported |
|
||||||
|-------------------------|-----------|
|
|-------------------------|-----------|
|
||||||
| Node IPv6 address | Yes |
|
| Node IPv6 address | Yes |
|
||||||
| Node Outbound IPv6 | Yes |
|
| Node Outbound IPv6 | Yes |
|
||||||
| Kubernetes Ingress IPv6 | Possible |
|
| Kubernetes Ingress IPv6 | Possible |
|
||||||
|
|
||||||
|
@ -1,11 +1,94 @@
|
|||||||
# Google Cloud
|
# Google Cloud
|
||||||
|
|
||||||
|
## Load Balancing
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### kube-apiserver
|
||||||
|
|
||||||
|
A global forwarding rule (IPv4 anycast) and TCP Proxy distribute IPv4 TCP/443 traffic across a backend service with zonal instance groups of controller(s) with a healthy `kube-apiserver` (TCP/6443). Clusters with multiple controllers span zones in a region to tolerate zone outages.
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
* GCP TCP Proxy limits external port options (e.g. must use 443, not 6443)
|
||||||
|
* A regional NLB cannot be used for multi-controller (see [#190](https://github.com/poseidon/typhoon/pull/190))
|
||||||
|
|
||||||
|
### HTTP/HTTP Ingress
|
||||||
|
|
||||||
|
Global forwarding rules and a TCP Proxy distribute IPv4/IPv6 TCP/80 and TCP/443 traffic across a managed instance group of workers with a healthy Ingress Controller. Workers span zones in a region to tolerate zone outages.
|
||||||
|
|
||||||
|
The IPv4 and IPv6 anycast addresses are output as `ingress_static_ipv4` and `ingress_static_ipv6` for use in DNS A and AAAA records. See [Ingress on Google Cloud](/addons/ingress/#google-cloud).
|
||||||
|
|
||||||
|
### TCP/UDP Services
|
||||||
|
|
||||||
|
Load balance TCP/UDP applications by adding a forwarding rule to the worker target pool (output).
|
||||||
|
|
||||||
|
```tf
|
||||||
|
# Static IPv4 address for some-app Load Balancing
|
||||||
|
resource "google_compute_address" "some-app-ipv4" {
|
||||||
|
name = "some-app-ipv4"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Forward IPv4 TCP traffic to the target pool
|
||||||
|
resource "google_compute_forwarding_rule" "some-app-tcp" {
|
||||||
|
name = "some-app-tcp"
|
||||||
|
ip_address = google_compute_address.some-app-ipv4.address
|
||||||
|
ip_protocol = "TCP"
|
||||||
|
port_range = "3333"
|
||||||
|
target = module.yavin.worker_target_pool
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Forward IPv4 UDP traffic to the target pool
|
||||||
|
resource "google_compute_forwarding_rule" "some-app-udp" {
|
||||||
|
name = "some-app-udp"
|
||||||
|
ip_address = google_compute_address.some-app-ipv4.address
|
||||||
|
ip_protocol = "UDP"
|
||||||
|
port_range = "3333"
|
||||||
|
target = module.yavin.worker_target_pool
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
* GCP Global Load Balancers aren't appropriate for custom TCP/UDP.
|
||||||
|
* Backend Services require a named port corresponding to an instance group (output by Typhoon) port. Typhoon shouldn't accept a list of every TCP/UDP service that may later be hosted on the cluster.
|
||||||
|
* Backend Services don't support UDP (i.e. rules out global load balancers)
|
||||||
|
* IPv4 Only: Regional Load Balancers use a regional IPv4 address (e.g. `google_compute_address`), no IPv6.
|
||||||
|
* Forward rules don't support differing external and internal ports. Some Ingress controllers (e.g. nginx) can proxy TCP/UDP traffic to achieve this.
|
||||||
|
* Worker target pool health checks workers `HTTP:10254/healthz` (i.e. `nginx-ingress`)
|
||||||
|
|
||||||
|
## Firewalls
|
||||||
|
|
||||||
|
Add firewall rules to the cluster's network.
|
||||||
|
|
||||||
|
```tf
|
||||||
|
resource "google_compute_firewall" "some-app" {
|
||||||
|
name = "some-app"
|
||||||
|
network = module.yavin.network_self_link
|
||||||
|
|
||||||
|
allow {
|
||||||
|
protocol = "tcp"
|
||||||
|
ports = [3333]
|
||||||
|
}
|
||||||
|
|
||||||
|
allow {
|
||||||
|
protocol = "udp"
|
||||||
|
ports = [3333]
|
||||||
|
}
|
||||||
|
|
||||||
|
source_ranges = ["0.0.0.0/0"]
|
||||||
|
target_tags = ["yavin-worker"]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## IPv6
|
## IPv6
|
||||||
|
|
||||||
Status of IPv6 on Typhoon Google Cloud clusters.
|
Applications exposed via HTTP/HTTPS Ingress can be served over IPv6.
|
||||||
|
|
||||||
| IPv6 Feature | Supported |
|
| IPv6 Feature | Supported |
|
||||||
|-------------------------|-----------|
|
|-------------------------|-----------|
|
||||||
| Node IPv6 address | No |
|
| Node IPv6 address | No |
|
||||||
| Node Outbound IPv6 | No |
|
| Node Outbound IPv6 | No |
|
||||||
| Kubernetes Ingress IPv6 | Yes |
|
| Kubernetes Ingress IPv6 | Yes |
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ Together, they diversify Typhoon to support a range of container technologies.
|
|||||||
|-------------------|-----------------|---------------|
|
|-------------------|-----------------|---------------|
|
||||||
| single-master | all platforms | all platforms |
|
| single-master | all platforms | all platforms |
|
||||||
| multi-master | all platforms | all platforms |
|
| multi-master | all platforms | all platforms |
|
||||||
| control plane | self-hosted | self-hosted |
|
| control plane | static pods | static pods |
|
||||||
| kubelet image | upstream hyperkube | upstream hyperkube |
|
| kubelet image | upstream hyperkube | upstream hyperkube |
|
||||||
| control plane images | upstream hyperkube | upstream hyperkube |
|
| control plane images | upstream hyperkube | upstream hyperkube |
|
||||||
| on-host etcd | rkt-fly | podman |
|
| on-host etcd | rkt-fly | podman |
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
# AWS
|
# AWS
|
||||||
|
|
||||||
In this tutorial, we'll create a Kubernetes v1.15.1 cluster on AWS with Container Linux.
|
In this tutorial, we'll create a Kubernetes v1.16.1 cluster on AWS with Container Linux.
|
||||||
|
|
||||||
We'll declare a Kubernetes cluster using the Typhoon Terraform module. Then apply the changes to create a VPC, gateway, subnets, security groups, controller instances, worker auto-scaling group, network load balancer, and TLS assets.
|
We'll declare a Kubernetes cluster using the Typhoon Terraform module. Then apply the changes to create a VPC, gateway, subnets, security groups, controller instances, worker auto-scaling group, network load balancer, and TLS assets.
|
||||||
|
|
||||||
Controllers are provisioned to run an `etcd-member` peer and a `kubelet` service. Workers run just a `kubelet` service. A one-time [bootkube](https://github.com/kubernetes-incubator/bootkube) bootstrap schedules the `apiserver`, `scheduler`, `controller-manager`, and `coredns` on controllers and schedules `kube-proxy` and `calico` (or `flannel`) on every node. A generated `kubeconfig` provides `kubectl` access to the cluster.
|
Controller hosts are provisioned to run an `etcd-member` peer and a `kubelet` service. Worker hosts run a `kubelet` service. Controller nodes run `kube-apiserver`, `kube-scheduler`, `kube-controller-manager`, and `coredns`, while `kube-proxy` and `calico` (or `flannel`) run on every node. A generated `kubeconfig` provides `kubectl` access to the cluster.
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
@ -18,15 +18,15 @@ Install [Terraform](https://www.terraform.io/downloads.html) v0.12.x on your sys
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ terraform version
|
$ terraform version
|
||||||
Terraform v0.12.2
|
Terraform v0.12.9
|
||||||
```
|
```
|
||||||
|
|
||||||
Add the [terraform-provider-ct](https://github.com/poseidon/terraform-provider-ct) plugin binary for your system to `~/.terraform.d/plugins/`, noting the final name.
|
Add the [terraform-provider-ct](https://github.com/poseidon/terraform-provider-ct) plugin binary for your system to `~/.terraform.d/plugins/`, noting the final name.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
wget https://github.com/poseidon/terraform-provider-ct/releases/download/v0.3.2/terraform-provider-ct-v0.3.2-linux-amd64.tar.gz
|
wget https://github.com/poseidon/terraform-provider-ct/releases/download/v0.4.0/terraform-provider-ct-v0.4.0-linux-amd64.tar.gz
|
||||||
tar xzf terraform-provider-ct-v0.3.2-linux-amd64.tar.gz
|
tar xzf terraform-provider-ct-v0.4.0-linux-amd64.tar.gz
|
||||||
mv terraform-provider-ct-v0.3.2-linux-amd64/terraform-provider-ct ~/.terraform.d/plugins/terraform-provider-ct_v0.3.2
|
mv terraform-provider-ct-v0.4.0-linux-amd64/terraform-provider-ct ~/.terraform.d/plugins/terraform-provider-ct_v0.4.0
|
||||||
```
|
```
|
||||||
|
|
||||||
Read [concepts](/architecture/concepts/) to learn about Terraform, modules, and organizing resources. Change to your infrastructure repository (e.g. `infra`).
|
Read [concepts](/architecture/concepts/) to learn about Terraform, modules, and organizing resources. Change to your infrastructure repository (e.g. `infra`).
|
||||||
@ -49,13 +49,13 @@ Configure the AWS provider to use your access key credentials in a `providers.tf
|
|||||||
|
|
||||||
```tf
|
```tf
|
||||||
provider "aws" {
|
provider "aws" {
|
||||||
version = "2.15.0"
|
version = "2.31.0"
|
||||||
region = "eu-central-1"
|
region = "eu-central-1"
|
||||||
shared_credentials_file = "/home/user/.config/aws/credentials"
|
shared_credentials_file = "/home/user/.config/aws/credentials"
|
||||||
}
|
}
|
||||||
|
|
||||||
provider "ct" {
|
provider "ct" {
|
||||||
version = "0.3.2"
|
version = "0.4.0"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -69,8 +69,8 @@ Additional configuration options are described in the `aws` provider [docs](http
|
|||||||
Define a Kubernetes cluster using the module `aws/container-linux/kubernetes`.
|
Define a Kubernetes cluster using the module `aws/container-linux/kubernetes`.
|
||||||
|
|
||||||
```tf
|
```tf
|
||||||
module "aws-tempest" {
|
module "tempest" {
|
||||||
source = "git::https://github.com/poseidon/typhoon//aws/container-linux/kubernetes?ref=v1.15.1"
|
source = "git::https://github.com/poseidon/typhoon//aws/container-linux/kubernetes?ref=v1.16.1"
|
||||||
|
|
||||||
# AWS
|
# AWS
|
||||||
cluster_name = "tempest"
|
cluster_name = "tempest"
|
||||||
@ -91,7 +91,7 @@ Reference the [variables docs](#variables) or the [variables.tf](https://github.
|
|||||||
|
|
||||||
## ssh-agent
|
## ssh-agent
|
||||||
|
|
||||||
Initial bootstrapping requires `bootkube.service` be started on one controller node. Terraform uses `ssh-agent` to automate this step. Add your SSH private key to `ssh-agent`.
|
Initial bootstrapping requires `bootstrap.service` be started on one controller node. Terraform uses `ssh-agent` to automate this step. Add your SSH private key to `ssh-agent`.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
ssh-add ~/.ssh/id_rsa
|
ssh-add ~/.ssh/id_rsa
|
||||||
@ -118,9 +118,9 @@ Apply the changes to create the cluster.
|
|||||||
```sh
|
```sh
|
||||||
$ terraform apply
|
$ terraform apply
|
||||||
...
|
...
|
||||||
module.aws-tempest.null_resource.bootkube-start: Still creating... (4m50s elapsed)
|
module.aws-tempest.null_resource.bootstrap: Still creating... (4m50s elapsed)
|
||||||
module.aws-tempest.null_resource.bootkube-start: Still creating... (5m0s elapsed)
|
module.aws-tempest.null_resource.bootstrap: Still creating... (5m0s elapsed)
|
||||||
module.aws-tempest.null_resource.bootkube-start: Creation complete after 11m8s (ID: 3961816482286168143)
|
module.aws-tempest.null_resource.bootstrap: Creation complete after 11m8s (ID: 3961816482286168143)
|
||||||
|
|
||||||
Apply complete! Resources: 98 added, 0 changed, 0 destroyed.
|
Apply complete! Resources: 98 added, 0 changed, 0 destroyed.
|
||||||
```
|
```
|
||||||
@ -134,10 +134,10 @@ In 4-8 minutes, the Kubernetes cluster will be ready.
|
|||||||
```
|
```
|
||||||
$ export KUBECONFIG=/home/user/.secrets/clusters/tempest/auth/kubeconfig
|
$ export KUBECONFIG=/home/user/.secrets/clusters/tempest/auth/kubeconfig
|
||||||
$ kubectl get nodes
|
$ kubectl get nodes
|
||||||
NAME STATUS ROLES AGE VERSION
|
NAME STATUS ROLES AGE VERSION
|
||||||
ip-10-0-3-155 Ready controller,master 10m v1.15.1
|
ip-10-0-3-155 Ready <none> 10m v1.16.1
|
||||||
ip-10-0-26-65 Ready node 10m v1.15.1
|
ip-10-0-26-65 Ready <none> 10m v1.16.1
|
||||||
ip-10-0-41-21 Ready node 10m v1.15.1
|
ip-10-0-41-21 Ready <none> 10m v1.16.1
|
||||||
```
|
```
|
||||||
|
|
||||||
List the pods.
|
List the pods.
|
||||||
@ -150,16 +150,12 @@ kube-system calico-node-7jmr1 2/2 Running 0
|
|||||||
kube-system calico-node-bknc8 2/2 Running 0 34m
|
kube-system calico-node-bknc8 2/2 Running 0 34m
|
||||||
kube-system coredns-1187388186-wx1lg 1/1 Running 0 34m
|
kube-system coredns-1187388186-wx1lg 1/1 Running 0 34m
|
||||||
kube-system coredns-1187388186-qjnvp 1/1 Running 0 34m
|
kube-system coredns-1187388186-qjnvp 1/1 Running 0 34m
|
||||||
kube-system kube-apiserver-4mjbk 1/1 Running 0 34m
|
kube-system kube-apiserver-ip-10-0-3-155 1/1 Running 0 34m
|
||||||
kube-system kube-controller-manager-3597210155-j2jbt 1/1 Running 1 34m
|
kube-system kube-controller-manager-ip-10-0-3-155 1/1 Running 0 34m
|
||||||
kube-system kube-controller-manager-3597210155-j7g7x 1/1 Running 0 34m
|
|
||||||
kube-system kube-proxy-14wxv 1/1 Running 0 34m
|
kube-system kube-proxy-14wxv 1/1 Running 0 34m
|
||||||
kube-system kube-proxy-9vxh2 1/1 Running 0 34m
|
kube-system kube-proxy-9vxh2 1/1 Running 0 34m
|
||||||
kube-system kube-proxy-sbbsh 1/1 Running 0 34m
|
kube-system kube-proxy-sbbsh 1/1 Running 0 34m
|
||||||
kube-system kube-scheduler-3359497473-5plhf 1/1 Running 0 34m
|
kube-system kube-scheduler-ip-10-0-3-155 1/1 Running 1 34m
|
||||||
kube-system kube-scheduler-3359497473-r7zg7 1/1 Running 1 34m
|
|
||||||
kube-system pod-checkpointer-4kxtl 1/1 Running 0 34m
|
|
||||||
kube-system pod-checkpointer-4kxtl-ip-10-0-3-155 1/1 Running 0 33m
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Going Further
|
## Going Further
|
||||||
@ -181,7 +177,7 @@ Check the [variables.tf](https://github.com/poseidon/typhoon/blob/master/aws/con
|
|||||||
| dns_zone | AWS Route53 DNS zone | "aws.example.com" |
|
| dns_zone | AWS Route53 DNS zone | "aws.example.com" |
|
||||||
| dns_zone_id | AWS Route53 DNS zone id | "Z3PAABBCFAKEC0" |
|
| dns_zone_id | AWS Route53 DNS zone id | "Z3PAABBCFAKEC0" |
|
||||||
| ssh_authorized_key | SSH public key for user 'core' | "ssh-rsa AAAAB3NZ..." |
|
| ssh_authorized_key | SSH public key for user 'core' | "ssh-rsa AAAAB3NZ..." |
|
||||||
| asset_dir | Path to a directory where generated assets should be placed (contains secrets) | "/home/user/.secrets/clusters/tempest" |
|
| asset_dir | Absolute path to a directory where generated assets should be placed (contains secrets) | "/home/user/.secrets/clusters/tempest" |
|
||||||
|
|
||||||
#### DNS Zone
|
#### DNS Zone
|
||||||
|
|
||||||
@ -195,7 +191,7 @@ resource "aws_route53_zone" "zone-for-clusters" {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Reference the DNS zone id with `"${aws_route53_zone.zone-for-clusters.zone_id}"`.
|
Reference the DNS zone id with `aws_route53_zone.zone-for-clusters.zone_id`.
|
||||||
|
|
||||||
!!! tip ""
|
!!! tip ""
|
||||||
If you have an existing domain name with a zone file elsewhere, just delegate a subdomain that can be managed on Route53 (e.g. aws.mydomain.com) and [update nameservers](http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/SOA-NSrecords.html).
|
If you have an existing domain name with a zone file elsewhere, just delegate a subdomain that can be managed on Route53 (e.g. aws.mydomain.com) and [update nameservers](http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/SOA-NSrecords.html).
|
||||||
@ -209,11 +205,11 @@ Reference the DNS zone id with `"${aws_route53_zone.zone-for-clusters.zone_id}"`
|
|||||||
| controller_type | EC2 instance type for controllers | "t3.small" | See below |
|
| controller_type | EC2 instance type for controllers | "t3.small" | See below |
|
||||||
| worker_type | EC2 instance type for workers | "t3.small" | See below |
|
| worker_type | EC2 instance type for workers | "t3.small" | See below |
|
||||||
| os_image | AMI channel for a Container Linux derivative | coreos-stable | coreos-stable, coreos-beta, coreos-alpha, flatcar-stable, flatcar-beta, flatcar-alpha, flatcar-edge |
|
| os_image | AMI channel for a Container Linux derivative | coreos-stable | coreos-stable, coreos-beta, coreos-alpha, flatcar-stable, flatcar-beta, flatcar-alpha, flatcar-edge |
|
||||||
| disk_size | Size of the EBS volume in GB | "40" | "100" |
|
| disk_size | Size of the EBS volume in GB | 40 | 100 |
|
||||||
| disk_type | Type of the EBS volume | "gp2" | standard, gp2, io1 |
|
| disk_type | Type of the EBS volume | "gp2" | standard, gp2, io1 |
|
||||||
| disk_iops | IOPS of the EBS volume | "0" (i.e. auto) | "400" |
|
| disk_iops | IOPS of the EBS volume | 0 (i.e. auto) | 400 |
|
||||||
| worker_target_groups | Target group ARNs to which worker instances should be added | [] | ["${aws_lb_target_group.app.id}"] |
|
| worker_target_groups | Target group ARNs to which worker instances should be added | [] | [aws_lb_target_group.app.id] |
|
||||||
| worker_price | Spot price in USD for workers. Leave as default empty string for regular on-demand instances | "" | "0.10" |
|
| worker_price | Spot price in USD for worker instances or 0 to use on-demand instances | 0/null | 0.10 |
|
||||||
| controller_clc_snippets | Controller Container Linux Config snippets | [] | [example](/advanced/customization/) |
|
| controller_clc_snippets | Controller Container Linux Config snippets | [] | [example](/advanced/customization/) |
|
||||||
| worker_clc_snippets | Worker Container Linux Config snippets | [] | [example](/advanced/customization/) |
|
| worker_clc_snippets | Worker Container Linux Config snippets | [] | [example](/advanced/customization/) |
|
||||||
| networking | Choice of networking provider | "calico" | "calico" or "flannel" |
|
| networking | Choice of networking provider | "calico" | "calico" or "flannel" |
|
||||||
@ -221,7 +217,7 @@ Reference the DNS zone id with `"${aws_route53_zone.zone-for-clusters.zone_id}"`
|
|||||||
| host_cidr | CIDR IPv4 range to assign to EC2 instances | "10.0.0.0/16" | "10.1.0.0/16" |
|
| host_cidr | CIDR IPv4 range to assign to EC2 instances | "10.0.0.0/16" | "10.1.0.0/16" |
|
||||||
| pod_cidr | CIDR IPv4 range to assign to Kubernetes pods | "10.2.0.0/16" | "10.22.0.0/16" |
|
| pod_cidr | CIDR IPv4 range to assign to Kubernetes pods | "10.2.0.0/16" | "10.22.0.0/16" |
|
||||||
| service_cidr | CIDR IPv4 range to assign to Kubernetes services | "10.3.0.0/16" | "10.3.0.0/24" |
|
| service_cidr | CIDR IPv4 range to assign to Kubernetes services | "10.3.0.0/16" | "10.3.0.0/24" |
|
||||||
| cluster_domain_suffix | FQDN suffix for Kubernetes services answered by coredns. | "cluster.local" | "k8s.example.com" |
|
| worker_node_labels | List of initial worker node labels | [] | ["worker-pool=default"] |
|
||||||
|
|
||||||
Check the list of valid [instance types](https://aws.amazon.com/ec2/instance-types/).
|
Check the list of valid [instance types](https://aws.amazon.com/ec2/instance-types/).
|
||||||
|
|
||||||
|
@ -3,11 +3,11 @@
|
|||||||
!!! danger
|
!!! danger
|
||||||
Typhoon for Azure is alpha. For production, use AWS, Google Cloud, or bare-metal. As Azure matures, check [errata](https://github.com/poseidon/typhoon/wiki/Errata) for known shortcomings.
|
Typhoon for Azure is alpha. For production, use AWS, Google Cloud, or bare-metal. As Azure matures, check [errata](https://github.com/poseidon/typhoon/wiki/Errata) for known shortcomings.
|
||||||
|
|
||||||
In this tutorial, we'll create a Kubernetes v1.15.1 cluster on Azure with Container Linux.
|
In this tutorial, we'll create a Kubernetes v1.16.1 cluster on Azure with Container Linux.
|
||||||
|
|
||||||
We'll declare a Kubernetes cluster using the Typhoon Terraform module. Then apply the changes to create a resource group, virtual network, subnets, security groups, controller availability set, worker scale set, load balancer, and TLS assets.
|
We'll declare a Kubernetes cluster using the Typhoon Terraform module. Then apply the changes to create a resource group, virtual network, subnets, security groups, controller availability set, worker scale set, load balancer, and TLS assets.
|
||||||
|
|
||||||
Controllers are provisioned to run an `etcd-member` peer and a `kubelet` service. Workers run just a `kubelet` service. A one-time [bootkube](https://github.com/kubernetes-incubator/bootkube) bootstrap schedules the `apiserver`, `scheduler`, `controller-manager`, and `coredns` on controllers and schedules `kube-proxy` and `flannel` on every node. A generated `kubeconfig` provides `kubectl` access to the cluster.
|
Controller hosts are provisioned to run an `etcd-member` peer and a `kubelet` service. Worker hosts run a `kubelet` service. Controller nodes run `kube-apiserver`, `kube-scheduler`, `kube-controller-manager`, and `coredns`, while `kube-proxy` and `calico` (or `flannel`) run on every node. A generated `kubeconfig` provides `kubectl` access to the cluster.
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
@ -21,15 +21,15 @@ Install [Terraform](https://www.terraform.io/downloads.html) v0.12.x on your sys
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ terraform version
|
$ terraform version
|
||||||
Terraform v0.12.2
|
Terraform v0.12.9
|
||||||
```
|
```
|
||||||
|
|
||||||
Add the [terraform-provider-ct](https://github.com/poseidon/terraform-provider-ct) plugin binary for your system to `~/.terraform.d/plugins/`, noting the final name.
|
Add the [terraform-provider-ct](https://github.com/poseidon/terraform-provider-ct) plugin binary for your system to `~/.terraform.d/plugins/`, noting the final name.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
wget https://github.com/poseidon/terraform-provider-ct/releases/download/v0.3.2/terraform-provider-ct-v0.3.2-linux-amd64.tar.gz
|
wget https://github.com/poseidon/terraform-provider-ct/releases/download/v0.4.0/terraform-provider-ct-v0.4.0-linux-amd64.tar.gz
|
||||||
tar xzf terraform-provider-ct-v0.3.2-linux-amd64.tar.gz
|
tar xzf terraform-provider-ct-v0.4.0-linux-amd64.tar.gz
|
||||||
mv terraform-provider-ct-v0.3.2-linux-amd64/terraform-provider-ct ~/.terraform.d/plugins/terraform-provider-ct_v0.3.2
|
mv terraform-provider-ct-v0.4.0-linux-amd64/terraform-provider-ct ~/.terraform.d/plugins/terraform-provider-ct_v0.4.0
|
||||||
```
|
```
|
||||||
|
|
||||||
Read [concepts](/architecture/concepts/) to learn about Terraform, modules, and organizing resources. Change to your infrastructure repository (e.g. `infra`).
|
Read [concepts](/architecture/concepts/) to learn about Terraform, modules, and organizing resources. Change to your infrastructure repository (e.g. `infra`).
|
||||||
@ -50,11 +50,11 @@ Configure the Azure provider in a `providers.tf` file.
|
|||||||
|
|
||||||
```tf
|
```tf
|
||||||
provider "azurerm" {
|
provider "azurerm" {
|
||||||
version = "1.30.1"
|
version = "1.35.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
provider "ct" {
|
provider "ct" {
|
||||||
version = "0.3.2"
|
version = "0.4.0"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -65,8 +65,8 @@ Additional configuration options are described in the `azurerm` provider [docs](
|
|||||||
Define a Kubernetes cluster using the module `azure/container-linux/kubernetes`.
|
Define a Kubernetes cluster using the module `azure/container-linux/kubernetes`.
|
||||||
|
|
||||||
```tf
|
```tf
|
||||||
module "azure-ramius" {
|
module "ramius" {
|
||||||
source = "git::https://github.com/poseidon/typhoon//azure/container-linux/kubernetes?ref=v1.15.1"
|
source = "git::https://github.com/poseidon/typhoon//azure/container-linux/kubernetes?ref=v1.16.1"
|
||||||
|
|
||||||
# Azure
|
# Azure
|
||||||
cluster_name = "ramius"
|
cluster_name = "ramius"
|
||||||
@ -88,7 +88,7 @@ Reference the [variables docs](#variables) or the [variables.tf](https://github.
|
|||||||
|
|
||||||
## ssh-agent
|
## ssh-agent
|
||||||
|
|
||||||
Initial bootstrapping requires `bootkube.service` be started on one controller node. Terraform uses `ssh-agent` to automate this step. Add your SSH private key to `ssh-agent`.
|
Initial bootstrapping requires `bootstrap.service` be started on one controller node. Terraform uses `ssh-agent` to automate this step. Add your SSH private key to `ssh-agent`.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
ssh-add ~/.ssh/id_rsa
|
ssh-add ~/.ssh/id_rsa
|
||||||
@ -115,9 +115,9 @@ Apply the changes to create the cluster.
|
|||||||
```sh
|
```sh
|
||||||
$ terraform apply
|
$ terraform apply
|
||||||
...
|
...
|
||||||
module.azure-ramius.null_resource.bootkube-start: Still creating... (6m50s elapsed)
|
module.azure-ramius.null_resource.bootstrap: Still creating... (6m50s elapsed)
|
||||||
module.azure-ramius.null_resource.bootkube-start: Still creating... (7m0s elapsed)
|
module.azure-ramius.null_resource.bootstrap: Still creating... (7m0s elapsed)
|
||||||
module.azure-ramius.null_resource.bootkube-start: Creation complete after 7m8s (ID: 3961816482286168143)
|
module.azure-ramius.null_resource.bootstrap: Creation complete after 7m8s (ID: 3961816482286168143)
|
||||||
|
|
||||||
Apply complete! Resources: 86 added, 0 changed, 0 destroyed.
|
Apply complete! Resources: 86 added, 0 changed, 0 destroyed.
|
||||||
```
|
```
|
||||||
@ -131,10 +131,10 @@ In 4-8 minutes, the Kubernetes cluster will be ready.
|
|||||||
```
|
```
|
||||||
$ export KUBECONFIG=/home/user/.secrets/clusters/ramius/auth/kubeconfig
|
$ export KUBECONFIG=/home/user/.secrets/clusters/ramius/auth/kubeconfig
|
||||||
$ kubectl get nodes
|
$ kubectl get nodes
|
||||||
NAME STATUS ROLES AGE VERSION
|
NAME STATUS ROLES AGE VERSION
|
||||||
ramius-controller-0 Ready controller,master 24m v1.15.1
|
ramius-controller-0 Ready <none> 24m v1.16.1
|
||||||
ramius-worker-000001 Ready node 25m v1.15.1
|
ramius-worker-000001 Ready <none> 25m v1.16.1
|
||||||
ramius-worker-000002 Ready node 24m v1.15.1
|
ramius-worker-000002 Ready <none> 24m v1.16.1
|
||||||
```
|
```
|
||||||
|
|
||||||
List the pods.
|
List the pods.
|
||||||
@ -144,19 +144,15 @@ $ kubectl get pods --all-namespaces
|
|||||||
NAMESPACE NAME READY STATUS RESTARTS AGE
|
NAMESPACE NAME READY STATUS RESTARTS AGE
|
||||||
kube-system coredns-7c6fbb4f4b-b6qzx 1/1 Running 0 26m
|
kube-system coredns-7c6fbb4f4b-b6qzx 1/1 Running 0 26m
|
||||||
kube-system coredns-7c6fbb4f4b-j2k3d 1/1 Running 0 26m
|
kube-system coredns-7c6fbb4f4b-j2k3d 1/1 Running 0 26m
|
||||||
kube-system flannel-bwf24 2/2 Running 2 26m
|
kube-system flannel-bwf24 2/2 Running 0 26m
|
||||||
kube-system flannel-ks5qb 2/2 Running 0 26m
|
kube-system flannel-ks5qb 2/2 Running 0 26m
|
||||||
kube-system flannel-tq2wg 2/2 Running 0 26m
|
kube-system flannel-tq2wg 2/2 Running 0 26m
|
||||||
kube-system kube-apiserver-hxgsx 1/1 Running 3 26m
|
kube-system kube-apiserver-ramius-controller-0 1/1 Running 0 26m
|
||||||
kube-system kube-controller-manager-5ff9cd7bb6-b942n 1/1 Running 0 26m
|
kube-system kube-controller-manager-ramius-controller-0 1/1 Running 0 26m
|
||||||
kube-system kube-controller-manager-5ff9cd7bb6-bbr6w 1/1 Running 0 26m
|
|
||||||
kube-system kube-proxy-j4vpq 1/1 Running 0 26m
|
kube-system kube-proxy-j4vpq 1/1 Running 0 26m
|
||||||
kube-system kube-proxy-jxr5d 1/1 Running 0 26m
|
kube-system kube-proxy-jxr5d 1/1 Running 0 26m
|
||||||
kube-system kube-proxy-lbdw5 1/1 Running 0 26m
|
kube-system kube-proxy-lbdw5 1/1 Running 0 26m
|
||||||
kube-system kube-scheduler-5f76d69686-s4fbx 1/1 Running 0 26m
|
kube-system kube-scheduler-ramius-controller-0 1/1 Running 0 26m
|
||||||
kube-system kube-scheduler-5f76d69686-vgdgn 1/1 Running 0 26m
|
|
||||||
kube-system pod-checkpointer-cnqdg 1/1 Running 0 26m
|
|
||||||
kube-system pod-checkpointer-cnqdg-ramius-controller-0 1/1 Running 0 25m
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Going Further
|
## Going Further
|
||||||
@ -179,7 +175,7 @@ Check the [variables.tf](https://github.com/poseidon/typhoon/blob/master/azure/c
|
|||||||
| dns_zone | Azure DNS zone | "azure.example.com" |
|
| dns_zone | Azure DNS zone | "azure.example.com" |
|
||||||
| dns_zone_group | Resource group where the Azure DNS zone resides | "global" |
|
| dns_zone_group | Resource group where the Azure DNS zone resides | "global" |
|
||||||
| ssh_authorized_key | SSH public key for user 'core' | "ssh-rsa AAAAB3NZ..." |
|
| ssh_authorized_key | SSH public key for user 'core' | "ssh-rsa AAAAB3NZ..." |
|
||||||
| asset_dir | Path to a directory where generated assets should be placed (contains secrets) | "/home/user/.secrets/clusters/ramius" |
|
| asset_dir | Absolute path to a directory where generated assets should be placed (contains secrets) | "/home/user/.secrets/clusters/ramius" |
|
||||||
|
|
||||||
!!! tip
|
!!! tip
|
||||||
Regions are shown in [docs](https://azure.microsoft.com/en-us/global-infrastructure/regions/) or with `az account list-locations --output table`.
|
Regions are shown in [docs](https://azure.microsoft.com/en-us/global-infrastructure/regions/) or with `az account list-locations --output table`.
|
||||||
@ -199,14 +195,14 @@ resource "azurerm_resource_group" "global" {
|
|||||||
|
|
||||||
# DNS zone for clusters
|
# DNS zone for clusters
|
||||||
resource "azurerm_dns_zone" "clusters" {
|
resource "azurerm_dns_zone" "clusters" {
|
||||||
resource_group_name = "${azurerm_resource_group.global.name}"
|
resource_group_name = azurerm_resource_group.global.name
|
||||||
|
|
||||||
name = "azure.example.com"
|
name = "azure.example.com"
|
||||||
zone_type = "Public"
|
zone_type = "Public"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Reference the DNS zone with `"${azurerm_dns_zone.clusters.name}"` and its resource group with `"${azurerm_resource_group.global.name}"`.
|
Reference the DNS zone with `azurerm_dns_zone.clusters.name` and its resource group with `"azurerm_resource_group.global.name`.
|
||||||
|
|
||||||
!!! tip ""
|
!!! tip ""
|
||||||
If you have an existing domain name with a zone file elsewhere, just delegate a subdomain that can be managed on Azure DNS (e.g. azure.mydomain.com) and [update nameservers](https://docs.microsoft.com/en-us/azure/dns/dns-delegate-domain-azure-dns).
|
If you have an existing domain name with a zone file elsewhere, just delegate a subdomain that can be managed on Azure DNS (e.g. azure.mydomain.com) and [update nameservers](https://docs.microsoft.com/en-us/azure/dns/dns-delegate-domain-azure-dns).
|
||||||
@ -217,18 +213,18 @@ Reference the DNS zone with `"${azurerm_dns_zone.clusters.name}"` and its resour
|
|||||||
|:-----|:------------|:--------|:--------|
|
|:-----|:------------|:--------|:--------|
|
||||||
| controller_count | Number of controllers (i.e. masters) | 1 | 1 |
|
| controller_count | Number of controllers (i.e. masters) | 1 | 1 |
|
||||||
| worker_count | Number of workers | 1 | 3 |
|
| worker_count | Number of workers | 1 | 3 |
|
||||||
| controller_type | Machine type for controllers | "Standard_DS1_v2" | See below |
|
| controller_type | Machine type for controllers | "Standard_B2s" | See below |
|
||||||
| worker_type | Machine type for workers | "Standard_F1" | See below |
|
| worker_type | Machine type for workers | "Standard_DS1_v2" | See below |
|
||||||
| os_image | Channel for a Container Linux derivative | coreos-stable | coreos-stable, coreos-beta, coreos-alpha |
|
| os_image | Channel for a Container Linux derivative | "coreos-stable" | coreos-stable, coreos-beta, coreos-alpha |
|
||||||
| disk_size | Size of the disk in GB | "40" | "100" |
|
| disk_size | Size of the disk in GB | 40 | 100 |
|
||||||
| worker_priority | Set priority to Low to use reduced cost surplus capacity, with the tradeoff that instances can be deallocated at any time | Regular | Low |
|
| worker_priority | Set priority to Low to use reduced cost surplus capacity, with the tradeoff that instances can be deallocated at any time | Regular | Low |
|
||||||
| controller_clc_snippets | Controller Container Linux Config snippets | [] | [example](/advanced/customization/#usage) |
|
| controller_clc_snippets | Controller Container Linux Config snippets | [] | [example](/advanced/customization/#usage) |
|
||||||
| worker_clc_snippets | Worker Container Linux Config snippets | [] | [example](/advanced/customization/#usage) |
|
| worker_clc_snippets | Worker Container Linux Config snippets | [] | [example](/advanced/customization/#usage) |
|
||||||
| networking | Choice of networking provider | "flannel" | "flannel" or "calico" (experimental) |
|
| networking | Choice of networking provider | "flannel" | "flannel" or "calico" |
|
||||||
| host_cidr | CIDR IPv4 range to assign to instances | "10.0.0.0/16" | "10.0.0.0/20" |
|
| host_cidr | CIDR IPv4 range to assign to instances | "10.0.0.0/16" | "10.0.0.0/20" |
|
||||||
| pod_cidr | CIDR IPv4 range to assign to Kubernetes pods | "10.2.0.0/16" | "10.22.0.0/16" |
|
| pod_cidr | CIDR IPv4 range to assign to Kubernetes pods | "10.2.0.0/16" | "10.22.0.0/16" |
|
||||||
| service_cidr | CIDR IPv4 range to assign to Kubernetes services | "10.3.0.0/16" | "10.3.0.0/24" |
|
| service_cidr | CIDR IPv4 range to assign to Kubernetes services | "10.3.0.0/16" | "10.3.0.0/24" |
|
||||||
| cluster_domain_suffix | FQDN suffix for Kubernetes services answered by coredns. | "cluster.local" | "k8s.example.com" |
|
| worker_node_labels | List of initial worker node labels | [] | ["worker-pool=default"] |
|
||||||
|
|
||||||
Check the list of valid [machine types](https://azure.microsoft.com/en-us/pricing/details/virtual-machines/linux/) and their [specs](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/sizes-general). Use `az vm list-skus` to get the identifier.
|
Check the list of valid [machine types](https://azure.microsoft.com/en-us/pricing/details/virtual-machines/linux/) and their [specs](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/sizes-general). Use `az vm list-skus` to get the identifier.
|
||||||
|
|
||||||
@ -236,7 +232,7 @@ Check the list of valid [machine types](https://azure.microsoft.com/en-us/pricin
|
|||||||
Unlike AWS and GCP, Azure requires its *virtual* networks to have non-overlapping IPv4 CIDRs (yeah, go figure). Instead of each cluster just using `10.0.0.0/16` for instances, each Azure cluster's `host_cidr` must be non-overlapping (e.g. 10.0.0.0/20 for the 1st cluster, 10.0.16.0/20 for the 2nd cluster, etc).
|
Unlike AWS and GCP, Azure requires its *virtual* networks to have non-overlapping IPv4 CIDRs (yeah, go figure). Instead of each cluster just using `10.0.0.0/16` for instances, each Azure cluster's `host_cidr` must be non-overlapping (e.g. 10.0.0.0/20 for the 1st cluster, 10.0.16.0/20 for the 2nd cluster, etc).
|
||||||
|
|
||||||
!!! warning
|
!!! warning
|
||||||
Do not choose a `controller_type` smaller than `Standard_DS1_v2`. Smaller instances are not sufficient for running a controller.
|
Do not choose a `controller_type` smaller than `Standard_B2s`. Smaller instances are not sufficient for running a controller.
|
||||||
|
|
||||||
#### Low Priority
|
#### Low Priority
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
# Bare-Metal
|
# Bare-Metal
|
||||||
|
|
||||||
In this tutorial, we'll network boot and provision a Kubernetes v1.15.1 cluster on bare-metal with Container Linux.
|
In this tutorial, we'll network boot and provision a Kubernetes v1.16.1 cluster on bare-metal with Container Linux.
|
||||||
|
|
||||||
First, we'll deploy a [Matchbox](https://github.com/poseidon/matchbox) service and setup a network boot environment. Then, we'll declare a Kubernetes cluster using the Typhoon Terraform module and power on machines. On PXE boot, machines will install Container Linux to disk, reboot into the disk install, and provision themselves as Kubernetes controllers or workers via Ignition.
|
First, we'll deploy a [Matchbox](https://github.com/poseidon/matchbox) service and setup a network boot environment. Then, we'll declare a Kubernetes cluster using the Typhoon Terraform module and power on machines. On PXE boot, machines will install Container Linux to disk, reboot into the disk install, and provision themselves as Kubernetes controllers or workers via Ignition.
|
||||||
|
|
||||||
Controllers are provisioned to run an `etcd-member` peer and a `kubelet` service. Workers run just a `kubelet` service. A one-time [bootkube](https://github.com/kubernetes-incubator/bootkube) bootstrap schedules the `apiserver`, `scheduler`, `controller-manager`, and `coredns` on controllers and schedules `kube-proxy` and `calico` (or `flannel`) on every node. A generated `kubeconfig` provides `kubectl` access to the cluster.
|
Controller hosts are provisioned to run an `etcd-member` peer and a `kubelet` service. Worker hosts run a `kubelet` service. Controller nodes run `kube-apiserver`, `kube-scheduler`, `kube-controller-manager`, and `coredns` while `kube-proxy` and `calico` (or `flannel`) run on every node. A generated `kubeconfig` provides `kubectl` access to the cluster.
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ Install [Terraform](https://www.terraform.io/downloads.html) v0.12.x on your sys
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ terraform version
|
$ terraform version
|
||||||
Terraform v0.12.2
|
Terraform v0.12.9
|
||||||
```
|
```
|
||||||
|
|
||||||
Add the [terraform-provider-matchbox](https://github.com/poseidon/terraform-provider-matchbox) plugin binary for your system to `~/.terraform.d/plugins/`, noting the final name.
|
Add the [terraform-provider-matchbox](https://github.com/poseidon/terraform-provider-matchbox) plugin binary for your system to `~/.terraform.d/plugins/`, noting the final name.
|
||||||
@ -125,9 +125,9 @@ mv terraform-provider-matchbox-v0.3.0-linux-amd64/terraform-provider-matchbox ~/
|
|||||||
Add the [terraform-provider-ct](https://github.com/poseidon/terraform-provider-ct) plugin binary for your system to `~/.terraform.d/plugins/`, noting the final name.
|
Add the [terraform-provider-ct](https://github.com/poseidon/terraform-provider-ct) plugin binary for your system to `~/.terraform.d/plugins/`, noting the final name.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
wget https://github.com/poseidon/terraform-provider-ct/releases/download/v0.3.2/terraform-provider-ct-v0.3.2-linux-amd64.tar.gz
|
wget https://github.com/poseidon/terraform-provider-ct/releases/download/v0.4.0/terraform-provider-ct-v0.4.0-linux-amd64.tar.gz
|
||||||
tar xzf terraform-provider-ct-v0.3.2-linux-amd64.tar.gz
|
tar xzf terraform-provider-ct-v0.4.0-linux-amd64.tar.gz
|
||||||
mv terraform-provider-ct-v0.3.2-linux-amd64/terraform-provider-ct ~/.terraform.d/plugins/terraform-provider-ct_v0.3.2
|
mv terraform-provider-ct-v0.4.0-linux-amd64/terraform-provider-ct ~/.terraform.d/plugins/terraform-provider-ct_v0.4.0
|
||||||
```
|
```
|
||||||
|
|
||||||
Read [concepts](/architecture/concepts/) to learn about Terraform, modules, and organizing resources. Change to your infrastructure repository (e.g. `infra`).
|
Read [concepts](/architecture/concepts/) to learn about Terraform, modules, and organizing resources. Change to your infrastructure repository (e.g. `infra`).
|
||||||
@ -144,13 +144,13 @@ Configure the Matchbox provider to use your Matchbox API endpoint and client cer
|
|||||||
provider "matchbox" {
|
provider "matchbox" {
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
endpoint = "matchbox.example.com:8081"
|
endpoint = "matchbox.example.com:8081"
|
||||||
client_cert = "${file("~/.config/matchbox/client.crt")}"
|
client_cert = file("~/.config/matchbox/client.crt")
|
||||||
client_key = "${file("~/.config/matchbox/client.key")}"
|
client_key = file("~/.config/matchbox/client.key")
|
||||||
ca = "${file("~/.config/matchbox/ca.crt")}"
|
ca = file("~/.config/matchbox/ca.crt")
|
||||||
}
|
}
|
||||||
|
|
||||||
provider "ct" {
|
provider "ct" {
|
||||||
version = "0.3.2"
|
version = "0.4.0"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -160,13 +160,13 @@ Define a Kubernetes cluster using the module `bare-metal/container-linux/kuberne
|
|||||||
|
|
||||||
```tf
|
```tf
|
||||||
module "bare-metal-mercury" {
|
module "bare-metal-mercury" {
|
||||||
source = "git::https://github.com/poseidon/typhoon//bare-metal/container-linux/kubernetes?ref=v1.15.1"
|
source = "git::https://github.com/poseidon/typhoon//bare-metal/container-linux/kubernetes?ref=v1.16.1"
|
||||||
|
|
||||||
# bare-metal
|
# bare-metal
|
||||||
cluster_name = "mercury"
|
cluster_name = "mercury"
|
||||||
matchbox_http_endpoint = "http://matchbox.example.com"
|
matchbox_http_endpoint = "http://matchbox.example.com"
|
||||||
os_channel = "coreos-stable"
|
os_channel = "coreos-stable"
|
||||||
os_version = "1632.3.0"
|
os_version = "2191.5.0"
|
||||||
|
|
||||||
# configuration
|
# configuration
|
||||||
k8s_domain_name = "node1.example.com"
|
k8s_domain_name = "node1.example.com"
|
||||||
@ -199,7 +199,7 @@ Reference the [variables docs](#variables) or the [variables.tf](https://github.
|
|||||||
|
|
||||||
## ssh-agent
|
## ssh-agent
|
||||||
|
|
||||||
Initial bootstrapping requires `bootkube.service` be started on one controller node. Terraform uses `ssh-agent` to automate this step. Add your SSH private key to `ssh-agent`.
|
Initial bootstrapping requires `bootstrap.service` be started on one controller node. Terraform uses `ssh-agent` to automate this step. Add your SSH private key to `ssh-agent`.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
ssh-add ~/.ssh/id_rsa
|
ssh-add ~/.ssh/id_rsa
|
||||||
@ -221,14 +221,12 @@ $ terraform plan
|
|||||||
Plan: 55 to add, 0 to change, 0 to destroy.
|
Plan: 55 to add, 0 to change, 0 to destroy.
|
||||||
```
|
```
|
||||||
|
|
||||||
Apply the changes. Terraform will generate bootkube assets to `asset_dir` and create Matchbox profiles (e.g. controller, worker) and matching rules via the Matchbox API.
|
Apply the changes. Terraform will generate bootstrap assets to `asset_dir` and create Matchbox profiles (e.g. controller, worker) and matching rules via the Matchbox API.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ terraform apply
|
$ terraform apply
|
||||||
module.bare-metal-mercury.null_resource.copy-kubeconfig.0: Provisioning with 'file'...
|
module.bare-metal-mercury.null_resource.copy-controller-secrets.0: Still creating... (10s elapsed)
|
||||||
module.bare-metal-mercury.null_resource.copy-etcd-secrets.0: Provisioning with 'file'...
|
module.bare-metal-mercury.null_resource.copy-worker-secrets.0: Still creating... (10s elapsed)
|
||||||
module.bare-metal-mercury.null_resource.copy-kubeconfig.0: Still creating... (10s elapsed)
|
|
||||||
module.bare-metal-mercury.null_resource.copy-etcd-secrets.0: Still creating... (10s elapsed)
|
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -250,14 +248,14 @@ Machines will network boot, install Container Linux to disk, reboot into the dis
|
|||||||
|
|
||||||
### Bootstrap
|
### Bootstrap
|
||||||
|
|
||||||
Wait for the `bootkube-start` step to finish bootstrapping the Kubernetes control plane. This may take 5-15 minutes depending on your network.
|
Wait for the `bootstrap` step to finish bootstrapping the Kubernetes control plane. This may take 5-15 minutes depending on your network.
|
||||||
|
|
||||||
```
|
```
|
||||||
module.bare-metal-mercury.null_resource.bootkube-start: Still creating... (6m10s elapsed)
|
module.bare-metal-mercury.null_resource.bootstrap: Still creating... (6m10s elapsed)
|
||||||
module.bare-metal-mercury.null_resource.bootkube-start: Still creating... (6m20s elapsed)
|
module.bare-metal-mercury.null_resource.bootstrap: Still creating... (6m20s elapsed)
|
||||||
module.bare-metal-mercury.null_resource.bootkube-start: Still creating... (6m30s elapsed)
|
module.bare-metal-mercury.null_resource.bootstrap: Still creating... (6m30s elapsed)
|
||||||
module.bare-metal-mercury.null_resource.bootkube-start: Still creating... (6m40s elapsed)
|
module.bare-metal-mercury.null_resource.bootstrap: Still creating... (6m40s elapsed)
|
||||||
module.bare-metal-mercury.null_resource.bootkube-start: Creation complete (ID: 5441741360626669024)
|
module.bare-metal-mercury.null_resource.bootstrap: Creation complete (ID: 5441741360626669024)
|
||||||
|
|
||||||
Apply complete! Resources: 55 added, 0 changed, 0 destroyed.
|
Apply complete! Resources: 55 added, 0 changed, 0 destroyed.
|
||||||
```
|
```
|
||||||
@ -265,9 +263,9 @@ Apply complete! Resources: 55 added, 0 changed, 0 destroyed.
|
|||||||
To watch the install to disk (until machines reboot from disk), SSH to port 2222.
|
To watch the install to disk (until machines reboot from disk), SSH to port 2222.
|
||||||
|
|
||||||
```
|
```
|
||||||
# before v1.15.1
|
# before v1.16.1
|
||||||
$ ssh debug@node1.example.com
|
$ ssh debug@node1.example.com
|
||||||
# after v1.15.1
|
# after v1.16.1
|
||||||
$ ssh -p 2222 core@node1.example.com
|
$ ssh -p 2222 core@node1.example.com
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -275,13 +273,12 @@ To watch the bootstrap process in detail, SSH to the first controller and journa
|
|||||||
|
|
||||||
```
|
```
|
||||||
$ ssh core@node1.example.com
|
$ ssh core@node1.example.com
|
||||||
$ journalctl -f -u bootkube
|
$ journalctl -f -u bootstrap
|
||||||
bootkube[5]: Pod Status: pod-checkpointer Running
|
podman[1750]: The connection to the server cluster.example.com:6443 was refused - did you specify the right host or port?
|
||||||
bootkube[5]: Pod Status: kube-apiserver Running
|
podman[1750]: Waiting for static pod control plane
|
||||||
bootkube[5]: Pod Status: kube-scheduler Running
|
...
|
||||||
bootkube[5]: Pod Status: kube-controller-manager Running
|
podman[1750]: serviceaccount/calico-node unchanged
|
||||||
bootkube[5]: All self-hosted control plane components successfully started
|
systemd[1]: Started Kubernetes control plane.
|
||||||
bootkube[5]: Tearing down temporary bootstrap control plane...
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Verify
|
## Verify
|
||||||
@ -291,10 +288,10 @@ bootkube[5]: Tearing down temporary bootstrap control plane...
|
|||||||
```
|
```
|
||||||
$ export KUBECONFIG=/home/user/.secrets/clusters/mercury/auth/kubeconfig
|
$ export KUBECONFIG=/home/user/.secrets/clusters/mercury/auth/kubeconfig
|
||||||
$ kubectl get nodes
|
$ kubectl get nodes
|
||||||
NAME STATUS ROLES AGE VERSION
|
NAME STATUS ROLES AGE VERSION
|
||||||
node1.example.com Ready controller,master 10m v1.15.1
|
node1.example.com Ready <none> 10m v1.16.1
|
||||||
node2.example.com Ready node 10m v1.15.1
|
node2.example.com Ready <none> 10m v1.16.1
|
||||||
node3.example.com Ready node 10m v1.15.1
|
node3.example.com Ready <none> 10m v1.16.1
|
||||||
```
|
```
|
||||||
|
|
||||||
List the pods.
|
List the pods.
|
||||||
@ -307,16 +304,12 @@ kube-system calico-node-gnjrm 2/2 Running 0
|
|||||||
kube-system calico-node-llbgt 2/2 Running 0 11m
|
kube-system calico-node-llbgt 2/2 Running 0 11m
|
||||||
kube-system coredns-1187388186-dj3pd 1/1 Running 0 11m
|
kube-system coredns-1187388186-dj3pd 1/1 Running 0 11m
|
||||||
kube-system coredns-1187388186-mx9rt 1/1 Running 0 11m
|
kube-system coredns-1187388186-mx9rt 1/1 Running 0 11m
|
||||||
kube-system kube-apiserver-7336w 1/1 Running 0 11m
|
kube-system kube-apiserver-node1.example.com 1/1 Running 0 11m
|
||||||
kube-system kube-controller-manager-3271970485-b9chx 1/1 Running 0 11m
|
kube-system kube-controller-node1.example.com 1/1 Running 1 11m
|
||||||
kube-system kube-controller-manager-3271970485-v30js 1/1 Running 1 11m
|
|
||||||
kube-system kube-proxy-50sd4 1/1 Running 0 11m
|
kube-system kube-proxy-50sd4 1/1 Running 0 11m
|
||||||
kube-system kube-proxy-bczhp 1/1 Running 0 11m
|
kube-system kube-proxy-bczhp 1/1 Running 0 11m
|
||||||
kube-system kube-proxy-mp2fw 1/1 Running 0 11m
|
kube-system kube-proxy-mp2fw 1/1 Running 0 11m
|
||||||
kube-system kube-scheduler-3895335239-fd3l7 1/1 Running 1 11m
|
kube-system kube-scheduler-node1.example.com 1/1 Running 0 11m
|
||||||
kube-system kube-scheduler-3895335239-hfjv0 1/1 Running 0 11m
|
|
||||||
kube-system pod-checkpointer-wf65d 1/1 Running 0 11m
|
|
||||||
kube-system pod-checkpointer-wf65d-node1.example.com 1/1 Running 0 11m
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Going Further
|
## Going Further
|
||||||
@ -334,13 +327,13 @@ Check the [variables.tf](https://github.com/poseidon/typhoon/blob/master/bare-me
|
|||||||
|
|
||||||
| Name | Description | Example |
|
| Name | Description | Example |
|
||||||
|:-----|:------------|:--------|
|
|:-----|:------------|:--------|
|
||||||
| cluster_name | Unique cluster name | mercury |
|
| cluster_name | Unique cluster name | "mercury" |
|
||||||
| matchbox_http_endpoint | Matchbox HTTP read-only endpoint | http://matchbox.example.com:port |
|
| matchbox_http_endpoint | Matchbox HTTP read-only endpoint | "http://matchbox.example.com:port" |
|
||||||
| os_channel | Channel for a Container Linux derivative | coreos-stable, coreos-beta, coreos-alpha, flatcar-stable, flatcar-beta, flatcar-alpha, flatcar-edge |
|
| os_channel | Channel for a Container Linux derivative | coreos-stable, coreos-beta, coreos-alpha, flatcar-stable, flatcar-beta, flatcar-alpha, flatcar-edge |
|
||||||
| os_version | Version for a Container Linux derivative to PXE and install | 1632.3.0 |
|
| os_version | Version for a Container Linux derivative to PXE and install | "1632.3.0" |
|
||||||
| k8s_domain_name | FQDN resolving to the controller(s) nodes. Workers and kubectl will communicate with this endpoint | "myk8s.example.com" |
|
| k8s_domain_name | FQDN resolving to the controller(s) nodes. Workers and kubectl will communicate with this endpoint | "myk8s.example.com" |
|
||||||
| ssh_authorized_key | SSH public key for user 'core' | "ssh-rsa AAAAB3Nz..." |
|
| ssh_authorized_key | SSH public key for user 'core' | "ssh-rsa AAAAB3Nz..." |
|
||||||
| asset_dir | Path to a directory where generated assets should be placed (contains secrets) | "/home/user/.secrets/clusters/mercury" |
|
| asset_dir | Absolute path to a directory where generated assets should be placed (contains secrets) | "/home/user/.secrets/clusters/mercury" |
|
||||||
| controller_names | Ordered list of controller short names | ["node1"] |
|
| controller_names | Ordered list of controller short names | ["node1"] |
|
||||||
| controller_macs | Ordered list of controller identifying MAC addresses | ["52:54:00:a1:9c:ae"] |
|
| controller_macs | Ordered list of controller identifying MAC addresses | ["52:54:00:a1:9c:ae"] |
|
||||||
| controller_domains | Ordered list of controller FQDNs | ["node1.example.com"] |
|
| controller_domains | Ordered list of controller FQDNs | ["node1.example.com"] |
|
||||||
@ -358,9 +351,8 @@ Check the [variables.tf](https://github.com/poseidon/typhoon/blob/master/bare-me
|
|||||||
| networking | Choice of networking provider | "calico" | "calico" or "flannel" |
|
| networking | Choice of networking provider | "calico" | "calico" or "flannel" |
|
||||||
| network_mtu | CNI interface MTU (calico-only) | 1480 | - |
|
| network_mtu | CNI interface MTU (calico-only) | 1480 | - |
|
||||||
| clc_snippets | Map from machine names to lists of Container Linux Config snippets | {} | [example](/advanced/customization/#usage) |
|
| clc_snippets | Map from machine names to lists of Container Linux Config snippets | {} | [example](/advanced/customization/#usage) |
|
||||||
| network_ip_autodetection_method | Method to detect host IPv4 address (calico-only) | first-found | can-reach=10.0.0.1 |
|
| network_ip_autodetection_method | Method to detect host IPv4 address (calico-only) | "first-found" | "can-reach=10.0.0.1" |
|
||||||
| pod_cidr | CIDR IPv4 range to assign to Kubernetes pods | "10.2.0.0/16" | "10.22.0.0/16" |
|
| pod_cidr | CIDR IPv4 range to assign to Kubernetes pods | "10.2.0.0/16" | "10.22.0.0/16" |
|
||||||
| service_cidr | CIDR IPv4 range to assign to Kubernetes services | "10.3.0.0/16" | "10.3.0.0/24" |
|
| service_cidr | CIDR IPv4 range to assign to Kubernetes services | "10.3.0.0/16" | "10.3.0.0/24" |
|
||||||
| cluster_domain_suffix | FQDN suffix for Kubernetes services answered by coredns. | "cluster.local" | "k8s.example.com" |
|
| kernel_args | Additional kernel args to provide at PXE boot | [] | ["kvm-intel.nested=1"] |
|
||||||
| kernel_args | Additional kernel args to provide at PXE boot | [] | "kvm-intel.nested=1" |
|
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
# Digital Ocean
|
# Digital Ocean
|
||||||
|
|
||||||
In this tutorial, we'll create a Kubernetes v1.15.1 cluster on DigitalOcean with Container Linux.
|
In this tutorial, we'll create a Kubernetes v1.16.1 cluster on DigitalOcean with Container Linux.
|
||||||
|
|
||||||
We'll declare a Kubernetes cluster using the Typhoon Terraform module. Then apply the changes to create controller droplets, worker droplets, DNS records, tags, and TLS assets.
|
We'll declare a Kubernetes cluster using the Typhoon Terraform module. Then apply the changes to create controller droplets, worker droplets, DNS records, tags, and TLS assets.
|
||||||
|
|
||||||
Controllers are provisioned to run an `etcd-member` peer and a `kubelet` service. Workers run just a `kubelet` service. A one-time [bootkube](https://github.com/kubernetes-incubator/bootkube) bootstrap schedules the `apiserver`, `scheduler`, `controller-manager`, and `coredns` on controllers and schedules `kube-proxy` and `flannel` on every node. A generated `kubeconfig` provides `kubectl` access to the cluster.
|
Controller hosts are provisioned to run an `etcd-member` peer and a `kubelet` service. Worker hosts run a `kubelet` service. Controller nodes run `kube-apiserver`, `kube-scheduler`, `kube-controller-manager`, and `coredns`, while `kube-proxy` and `calico` (or `flannel`) run on every node. A generated `kubeconfig` provides `kubectl` access to the cluster.
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
@ -18,15 +18,15 @@ Install [Terraform](https://www.terraform.io/downloads.html) v0.12.x on your sys
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ terraform version
|
$ terraform version
|
||||||
Terraform v0.12.2
|
Terraform v0.12.9
|
||||||
```
|
```
|
||||||
|
|
||||||
Add the [terraform-provider-ct](https://github.com/poseidon/terraform-provider-ct) plugin binary for your system to `~/.terraform.d/plugins/`, noting the final name.
|
Add the [terraform-provider-ct](https://github.com/poseidon/terraform-provider-ct) plugin binary for your system to `~/.terraform.d/plugins/`, noting the final name.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
wget https://github.com/poseidon/terraform-provider-ct/releases/download/v0.3.2/terraform-provider-ct-v0.3.2-linux-amd64.tar.gz
|
wget https://github.com/poseidon/terraform-provider-ct/releases/download/v0.4.0/terraform-provider-ct-v0.4.0-linux-amd64.tar.gz
|
||||||
tar xzf terraform-provider-ct-v0.3.2-linux-amd64.tar.gz
|
tar xzf terraform-provider-ct-v0.4.0-linux-amd64.tar.gz
|
||||||
mv terraform-provider-ct-v0.3.2-linux-amd64/terraform-provider-ct ~/.terraform.d/plugins/terraform-provider-ct_v0.3.2
|
mv terraform-provider-ct-v0.4.0-linux-amd64/terraform-provider-ct ~/.terraform.d/plugins/terraform-provider-ct_v0.4.0
|
||||||
```
|
```
|
||||||
|
|
||||||
Read [concepts](/architecture/concepts/) to learn about Terraform, modules, and organizing resources. Change to your infrastructure repository (e.g. `infra`).
|
Read [concepts](/architecture/concepts/) to learn about Terraform, modules, and organizing resources. Change to your infrastructure repository (e.g. `infra`).
|
||||||
@ -50,12 +50,12 @@ Configure the DigitalOcean provider to use your token in a `providers.tf` file.
|
|||||||
|
|
||||||
```tf
|
```tf
|
||||||
provider "digitalocean" {
|
provider "digitalocean" {
|
||||||
version = "1.4.0"
|
version = "1.8.0"
|
||||||
token = "${chomp(file("~/.config/digital-ocean/token"))}"
|
token = "${chomp(file("~/.config/digital-ocean/token"))}"
|
||||||
}
|
}
|
||||||
|
|
||||||
provider "ct" {
|
provider "ct" {
|
||||||
version = "0.3.2"
|
version = "0.4.0"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ Define a Kubernetes cluster using the module `digital-ocean/container-linux/kube
|
|||||||
|
|
||||||
```tf
|
```tf
|
||||||
module "digital-ocean-nemo" {
|
module "digital-ocean-nemo" {
|
||||||
source = "git::https://github.com/poseidon/typhoon//digital-ocean/container-linux/kubernetes?ref=v1.15.1"
|
source = "git::https://github.com/poseidon/typhoon//digital-ocean/container-linux/kubernetes?ref=v1.16.1"
|
||||||
|
|
||||||
# Digital Ocean
|
# Digital Ocean
|
||||||
cluster_name = "nemo"
|
cluster_name = "nemo"
|
||||||
@ -85,7 +85,7 @@ Reference the [variables docs](#variables) or the [variables.tf](https://github.
|
|||||||
|
|
||||||
## ssh-agent
|
## ssh-agent
|
||||||
|
|
||||||
Initial bootstrapping requires `bootkube.service` be started on one controller node. Terraform uses `ssh-agent` to automate this step. Add your SSH private key to `ssh-agent`.
|
Initial bootstrapping requires `bootstrap.service` be started on one controller node. Terraform uses `ssh-agent` to automate this step. Add your SSH private key to `ssh-agent`.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
ssh-add ~/.ssh/id_rsa
|
ssh-add ~/.ssh/id_rsa
|
||||||
@ -111,11 +111,11 @@ Apply the changes to create the cluster.
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ terraform apply
|
$ terraform apply
|
||||||
module.digital-ocean-nemo.null_resource.bootkube-start: Still creating... (30s elapsed)
|
module.digital-ocean-nemo.null_resource.bootstrap: Still creating... (30s elapsed)
|
||||||
module.digital-ocean-nemo.null_resource.bootkube-start: Provisioning with 'remote-exec'...
|
module.digital-ocean-nemo.null_resource.bootstrap: Provisioning with 'remote-exec'...
|
||||||
...
|
...
|
||||||
module.digital-ocean-nemo.null_resource.bootkube-start: Still creating... (6m20s elapsed)
|
module.digital-ocean-nemo.null_resource.bootstrap: Still creating... (6m20s elapsed)
|
||||||
module.digital-ocean-nemo.null_resource.bootkube-start: Creation complete (ID: 7599298447329218468)
|
module.digital-ocean-nemo.null_resource.bootstrap: Creation complete (ID: 7599298447329218468)
|
||||||
|
|
||||||
Apply complete! Resources: 54 added, 0 changed, 0 destroyed.
|
Apply complete! Resources: 54 added, 0 changed, 0 destroyed.
|
||||||
```
|
```
|
||||||
@ -129,10 +129,10 @@ In 3-6 minutes, the Kubernetes cluster will be ready.
|
|||||||
```
|
```
|
||||||
$ export KUBECONFIG=/home/user/.secrets/clusters/nemo/auth/kubeconfig
|
$ export KUBECONFIG=/home/user/.secrets/clusters/nemo/auth/kubeconfig
|
||||||
$ kubectl get nodes
|
$ kubectl get nodes
|
||||||
NAME STATUS ROLES AGE VERSION
|
NAME STATUS ROLES AGE VERSION
|
||||||
10.132.110.130 Ready controller,master 10m v1.15.1
|
10.132.110.130 Ready <none> 10m v1.16.1
|
||||||
10.132.115.81 Ready node 10m v1.15.1
|
10.132.115.81 Ready <none> 10m v1.16.1
|
||||||
10.132.124.107 Ready node 10m v1.15.1
|
10.132.124.107 Ready <none> 10m v1.16.1
|
||||||
```
|
```
|
||||||
|
|
||||||
List the pods.
|
List the pods.
|
||||||
@ -142,18 +142,14 @@ NAMESPACE NAME READY STATUS RES
|
|||||||
kube-system coredns-1187388186-ld1j7 1/1 Running 0 11m
|
kube-system coredns-1187388186-ld1j7 1/1 Running 0 11m
|
||||||
kube-system coredns-1187388186-rdhf7 1/1 Running 0 11m
|
kube-system coredns-1187388186-rdhf7 1/1 Running 0 11m
|
||||||
kube-system flannel-1cq1v 2/2 Running 0 11m
|
kube-system flannel-1cq1v 2/2 Running 0 11m
|
||||||
kube-system flannel-hq9t0 2/2 Running 1 11m
|
kube-system flannel-hq9t0 2/2 Running 0 11m
|
||||||
kube-system flannel-v0g9w 2/2 Running 0 11m
|
kube-system flannel-v0g9w 2/2 Running 0 11m
|
||||||
kube-system kube-apiserver-n10qr 1/1 Running 0 11m
|
kube-system kube-apiserver-ip-10.132.115.81 1/1 Running 0 11m
|
||||||
kube-system kube-controller-manager-3271970485-37gtw 1/1 Running 1 11m
|
kube-system kube-controller-manager-ip-10.132.115.81 1/1 Running 0 11m
|
||||||
kube-system kube-controller-manager-3271970485-p52t5 1/1 Running 0 11m
|
|
||||||
kube-system kube-proxy-6kxjf 1/1 Running 0 11m
|
kube-system kube-proxy-6kxjf 1/1 Running 0 11m
|
||||||
kube-system kube-proxy-fh3td 1/1 Running 0 11m
|
kube-system kube-proxy-fh3td 1/1 Running 0 11m
|
||||||
kube-system kube-proxy-k35rc 1/1 Running 0 11m
|
kube-system kube-proxy-k35rc 1/1 Running 0 11m
|
||||||
kube-system kube-scheduler-3895335239-2bc4c 1/1 Running 0 11m
|
kube-system kube-scheduler-ip-10.132.115.81 1/1 Running 0 11m
|
||||||
kube-system kube-scheduler-3895335239-b7q47 1/1 Running 1 11m
|
|
||||||
kube-system pod-checkpointer-pr1lq 1/1 Running 0 11m
|
|
||||||
kube-system pod-checkpointer-pr1lq-10.132.115.81 1/1 Running 0 10m
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Going Further
|
## Going Further
|
||||||
@ -171,11 +167,11 @@ Check the [variables.tf](https://github.com/poseidon/typhoon/blob/master/digital
|
|||||||
|
|
||||||
| Name | Description | Example |
|
| Name | Description | Example |
|
||||||
|:-----|:------------|:--------|
|
|:-----|:------------|:--------|
|
||||||
| cluster_name | Unique cluster name (prepended to dns_zone) | nemo |
|
| cluster_name | Unique cluster name (prepended to dns_zone) | "nemo" |
|
||||||
| region | Digital Ocean region | nyc1, sfo2, fra1, tor1 |
|
| region | Digital Ocean region | "nyc1", "sfo2", "fra1", tor1" |
|
||||||
| dns_zone | Digital Ocean domain (i.e. DNS zone) | do.example.com |
|
| dns_zone | Digital Ocean domain (i.e. DNS zone) | "do.example.com" |
|
||||||
| ssh_fingerprints | SSH public key fingerprints | ["d7:9d..."] |
|
| ssh_fingerprints | SSH public key fingerprints | ["d7:9d..."] |
|
||||||
| asset_dir | Path to a directory where generated assets should be placed (contains secrets) | /home/user/.secrets/nemo |
|
| asset_dir | Absolute path to a directory where generated assets should be placed (contains secrets) | "/home/user/.secrets/nemo" |
|
||||||
|
|
||||||
#### DNS Zone
|
#### DNS Zone
|
||||||
|
|
||||||
@ -218,15 +214,14 @@ Digital Ocean requires the SSH public key be uploaded to your account, so you ma
|
|||||||
|:-----|:------------|:--------|:--------|
|
|:-----|:------------|:--------|:--------|
|
||||||
| controller_count | Number of controllers (i.e. masters) | 1 | 1 |
|
| controller_count | Number of controllers (i.e. masters) | 1 | 1 |
|
||||||
| worker_count | Number of workers | 1 | 3 |
|
| worker_count | Number of workers | 1 | 3 |
|
||||||
| controller_type | Droplet type for controllers | s-2vcpu-2gb | s-2vcpu-2gb, s-2vcpu-4gb, s-4vcpu-8gb, ... |
|
| controller_type | Droplet type for controllers | "s-2vcpu-2gb" | s-2vcpu-2gb, s-2vcpu-4gb, s-4vcpu-8gb, ... |
|
||||||
| worker_type | Droplet type for workers | s-1vcpu-2gb | s-1vcpu-2gb, s-2vcpu-2gb, ... |
|
| worker_type | Droplet type for workers | "s-1vcpu-2gb" | s-1vcpu-2gb, s-2vcpu-2gb, ... |
|
||||||
| image | Container Linux image for instances | "coreos-stable" | coreos-stable, coreos-beta, coreos-alpha |
|
| image | Container Linux image for instances | "coreos-stable" | coreos-stable, coreos-beta, coreos-alpha |
|
||||||
| controller_clc_snippets | Controller Container Linux Config snippets | [] | [example](/advanced/customization/) |
|
| controller_clc_snippets | Controller Container Linux Config snippets | [] | [example](/advanced/customization/) |
|
||||||
| worker_clc_snippets | Worker Container Linux Config snippets | [] | [example](/advanced/customization/) |
|
| worker_clc_snippets | Worker Container Linux Config snippets | [] | [example](/advanced/customization/) |
|
||||||
| networking | Choice of networking provider | "flannel" | "flannel" or "calico" (experimental) |
|
| networking | Choice of networking provider | "flannel" | "flannel" or "calico" |
|
||||||
| pod_cidr | CIDR IPv4 range to assign to Kubernetes pods | "10.2.0.0/16" | "10.22.0.0/16" |
|
| pod_cidr | CIDR IPv4 range to assign to Kubernetes pods | "10.2.0.0/16" | "10.22.0.0/16" |
|
||||||
| service_cidr | CIDR IPv4 range to assign to Kubernetes services | "10.3.0.0/16" | "10.3.0.0/24" |
|
| service_cidr | CIDR IPv4 range to assign to Kubernetes services | "10.3.0.0/16" | "10.3.0.0/24" |
|
||||||
| cluster_domain_suffix | FQDN suffix for Kubernetes services answered by coredns. | "cluster.local" | "k8s.example.com" |
|
|
||||||
|
|
||||||
Check the list of valid [droplet types](https://developers.digitalocean.com/documentation/changelog/api-v2/new-size-slugs-for-droplet-plan-changes/) or use `doctl compute size list`.
|
Check the list of valid [droplet types](https://developers.digitalocean.com/documentation/changelog/api-v2/new-size-slugs-for-droplet-plan-changes/) or use `doctl compute size list`.
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
# Google Cloud
|
# Google Cloud
|
||||||
|
|
||||||
In this tutorial, we'll create a Kubernetes v1.15.1 cluster on Google Compute Engine with Container Linux.
|
In this tutorial, we'll create a Kubernetes v1.16.1 cluster on Google Compute Engine with Container Linux.
|
||||||
|
|
||||||
We'll declare a Kubernetes cluster using the Typhoon Terraform module. Then apply the changes to create a network, firewall rules, health checks, controller instances, worker managed instance group, load balancers, and TLS assets.
|
We'll declare a Kubernetes cluster using the Typhoon Terraform module. Then apply the changes to create a network, firewall rules, health checks, controller instances, worker managed instance group, load balancers, and TLS assets.
|
||||||
|
|
||||||
Controllers are provisioned to run an `etcd-member` peer and a `kubelet` service. Workers run just a `kubelet` service. A one-time [bootkube](https://github.com/kubernetes-incubator/bootkube) bootstrap schedules the `apiserver`, `scheduler`, `controller-manager`, and `coredns` on controllers and schedules `kube-proxy` and `calico` (or `flannel`) on every node. A generated `kubeconfig` provides `kubectl` access to the cluster.
|
Controller hosts are provisioned to run an `etcd-member` peer and a `kubelet` service. Worker hosts run a `kubelet` service. Controller nodes run `kube-apiserver`, `kube-scheduler`, `kube-controller-manager`, and `coredns`, while `kube-proxy` and `calico` (or `flannel`) run on every node. A generated `kubeconfig` provides `kubectl` access to the cluster.
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
@ -18,15 +18,15 @@ Install [Terraform](https://www.terraform.io/downloads.html) v0.12.x on your sys
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ terraform version
|
$ terraform version
|
||||||
Terraform v0.12.2
|
Terraform v0.12.9
|
||||||
```
|
```
|
||||||
|
|
||||||
Add the [terraform-provider-ct](https://github.com/poseidon/terraform-provider-ct) plugin binary for your system to `~/.terraform.d/plugins/`, noting the final name.
|
Add the [terraform-provider-ct](https://github.com/poseidon/terraform-provider-ct) plugin binary for your system to `~/.terraform.d/plugins/`, noting the final name.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
wget https://github.com/poseidon/terraform-provider-ct/releases/download/v0.3.2/terraform-provider-ct-v0.3.2-linux-amd64.tar.gz
|
wget https://github.com/poseidon/terraform-provider-ct/releases/download/v0.4.0/terraform-provider-ct-v0.4.0-linux-amd64.tar.gz
|
||||||
tar xzf terraform-provider-ct-v0.3.2-linux-amd64.tar.gz
|
tar xzf terraform-provider-ct-v0.4.0-linux-amd64.tar.gz
|
||||||
mv terraform-provider-ct-v0.3.2-linux-amd64/terraform-provider-ct ~/.terraform.d/plugins/terraform-provider-ct_v0.3.2
|
mv terraform-provider-ct-v0.4.0-linux-amd64/terraform-provider-ct ~/.terraform.d/plugins/terraform-provider-ct_v0.4.0
|
||||||
```
|
```
|
||||||
|
|
||||||
Read [concepts](/architecture/concepts/) to learn about Terraform, modules, and organizing resources. Change to your infrastructure repository (e.g. `infra`).
|
Read [concepts](/architecture/concepts/) to learn about Terraform, modules, and organizing resources. Change to your infrastructure repository (e.g. `infra`).
|
||||||
@ -49,14 +49,14 @@ Configure the Google Cloud provider to use your service account key, project-id,
|
|||||||
|
|
||||||
```tf
|
```tf
|
||||||
provider "google" {
|
provider "google" {
|
||||||
version = "2.9.0"
|
version = "2.16.0"
|
||||||
project = "project-id"
|
project = "project-id"
|
||||||
region = "us-central1"
|
region = "us-central1"
|
||||||
credentials = "${file("~/.config/google-cloud/terraform.json")}"
|
credentials = file("~/.config/google-cloud/terraform.json")
|
||||||
}
|
}
|
||||||
|
|
||||||
provider "ct" {
|
provider "ct" {
|
||||||
version = "0.3.2"
|
version = "0.4.0"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ Define a Kubernetes cluster using the module `google-cloud/container-linux/kuber
|
|||||||
|
|
||||||
```tf
|
```tf
|
||||||
module "google-cloud-yavin" {
|
module "google-cloud-yavin" {
|
||||||
source = "git::https://github.com/poseidon/typhoon//google-cloud/container-linux/kubernetes?ref=v1.15.1"
|
source = "git::https://github.com/poseidon/typhoon//google-cloud/container-linux/kubernetes?ref=v1.16.1"
|
||||||
|
|
||||||
# Google Cloud
|
# Google Cloud
|
||||||
cluster_name = "yavin"
|
cluster_name = "yavin"
|
||||||
@ -92,7 +92,7 @@ Reference the [variables docs](#variables) or the [variables.tf](https://github.
|
|||||||
|
|
||||||
## ssh-agent
|
## ssh-agent
|
||||||
|
|
||||||
Initial bootstrapping requires `bootkube.service` be started on one controller node. Terraform uses `ssh-agent` to automate this step. Add your SSH private key to `ssh-agent`.
|
Initial bootstrapping requires `bootstrap.service` be started on one controller node. Terraform uses `ssh-agent` to automate this step. Add your SSH private key to `ssh-agent`.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
ssh-add ~/.ssh/id_rsa
|
ssh-add ~/.ssh/id_rsa
|
||||||
@ -118,12 +118,11 @@ Apply the changes to create the cluster.
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ terraform apply
|
$ terraform apply
|
||||||
module.google-cloud-yavin.null_resource.bootkube-start: Still creating... (10s elapsed)
|
module.google-cloud-yavin.null_resource.bootstrap: Still creating... (10s elapsed)
|
||||||
...
|
...
|
||||||
|
module.google-cloud-yavin.null_resource.bootstrap: Still creating... (5m30s elapsed)
|
||||||
module.google-cloud-yavin.null_resource.bootkube-start: Still creating... (5m30s elapsed)
|
module.google-cloud-yavin.null_resource.bootstrap: Still creating... (5m40s elapsed)
|
||||||
module.google-cloud-yavin.null_resource.bootkube-start: Still creating... (5m40s elapsed)
|
module.google-cloud-yavin.null_resource.bootstrap: Creation complete (ID: 5768638456220583358)
|
||||||
module.google-cloud-yavin.null_resource.bootkube-start: Creation complete (ID: 5768638456220583358)
|
|
||||||
|
|
||||||
Apply complete! Resources: 64 added, 0 changed, 0 destroyed.
|
Apply complete! Resources: 64 added, 0 changed, 0 destroyed.
|
||||||
```
|
```
|
||||||
@ -137,10 +136,10 @@ In 4-8 minutes, the Kubernetes cluster will be ready.
|
|||||||
```
|
```
|
||||||
$ export KUBECONFIG=/home/user/.secrets/clusters/yavin/auth/kubeconfig
|
$ export KUBECONFIG=/home/user/.secrets/clusters/yavin/auth/kubeconfig
|
||||||
$ kubectl get nodes
|
$ kubectl get nodes
|
||||||
NAME ROLES STATUS AGE VERSION
|
NAME ROLES STATUS AGE VERSION
|
||||||
yavin-controller-0.c.example-com.internal controller,master Ready 6m v1.15.1
|
yavin-controller-0.c.example-com.internal <none> Ready 6m v1.16.1
|
||||||
yavin-worker-jrbf.c.example-com.internal node Ready 5m v1.15.1
|
yavin-worker-jrbf.c.example-com.internal <none> Ready 5m v1.16.1
|
||||||
yavin-worker-mzdm.c.example-com.internal node Ready 5m v1.15.1
|
yavin-worker-mzdm.c.example-com.internal <none> Ready 5m v1.16.1
|
||||||
```
|
```
|
||||||
|
|
||||||
List the pods.
|
List the pods.
|
||||||
@ -153,15 +152,12 @@ kube-system calico-node-d1l5b 2/2 Running 0
|
|||||||
kube-system calico-node-sp9ps 2/2 Running 0 6m
|
kube-system calico-node-sp9ps 2/2 Running 0 6m
|
||||||
kube-system coredns-1187388186-dkh3o 1/1 Running 0 6m
|
kube-system coredns-1187388186-dkh3o 1/1 Running 0 6m
|
||||||
kube-system coredns-1187388186-zj5dl 1/1 Running 0 6m
|
kube-system coredns-1187388186-zj5dl 1/1 Running 0 6m
|
||||||
kube-system kube-apiserver-zppls 1/1 Running 0 6m
|
kube-system kube-apiserver-controller-0 1/1 Running 0 6m
|
||||||
kube-system kube-controller-manager-3271970485-gh9kt 1/1 Running 0 6m
|
kube-system kube-controller-manager-controller-0 1/1 Running 0 6m
|
||||||
kube-system kube-controller-manager-3271970485-h90v8 1/1 Running 1 6m
|
|
||||||
kube-system kube-proxy-117v6 1/1 Running 0 6m
|
kube-system kube-proxy-117v6 1/1 Running 0 6m
|
||||||
kube-system kube-proxy-9886n 1/1 Running 0 6m
|
kube-system kube-proxy-9886n 1/1 Running 0 6m
|
||||||
kube-system kube-proxy-njn47 1/1 Running 0 6m
|
kube-system kube-proxy-njn47 1/1 Running 0 6m
|
||||||
kube-system kube-scheduler-3895335239-5x87r 1/1 Running 0 6m
|
kube-system kube-scheduler-controller-0 1/1 Running 0 6m
|
||||||
kube-system kube-scheduler-3895335239-bzrrt 1/1 Running 1 6m
|
|
||||||
kube-system pod-checkpointer-l6lrt 1/1 Running 0 6m
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Going Further
|
## Going Further
|
||||||
@ -184,7 +180,7 @@ Check the [variables.tf](https://github.com/poseidon/typhoon/blob/master/google-
|
|||||||
| dns_zone | Google Cloud DNS zone | "google-cloud.example.com" |
|
| dns_zone | Google Cloud DNS zone | "google-cloud.example.com" |
|
||||||
| dns_zone_name | Google Cloud DNS zone name | "example-zone" |
|
| dns_zone_name | Google Cloud DNS zone name | "example-zone" |
|
||||||
| ssh_authorized_key | SSH public key for user 'core' | "ssh-rsa AAAAB3NZ..." |
|
| ssh_authorized_key | SSH public key for user 'core' | "ssh-rsa AAAAB3NZ..." |
|
||||||
| asset_dir | Path to a directory where generated assets should be placed (contains secrets) | "/home/user/.secrets/clusters/yavin" |
|
| asset_dir | Absolute path to a directory where generated assets should be placed (contains secrets) | "/home/user/.secrets/clusters/yavin" |
|
||||||
|
|
||||||
Check the list of valid [regions](https://cloud.google.com/compute/docs/regions-zones/regions-zones) and list Container Linux [images](https://cloud.google.com/compute/docs/images) with `gcloud compute images list | grep coreos`.
|
Check the list of valid [regions](https://cloud.google.com/compute/docs/regions-zones/regions-zones) and list Container Linux [images](https://cloud.google.com/compute/docs/images) with `gcloud compute images list | grep coreos`.
|
||||||
|
|
||||||
@ -221,11 +217,11 @@ resource "google_dns_managed_zone" "zone-for-clusters" {
|
|||||||
| networking | Choice of networking provider | "calico" | "calico" or "flannel" |
|
| networking | Choice of networking provider | "calico" | "calico" or "flannel" |
|
||||||
| pod_cidr | CIDR IPv4 range to assign to Kubernetes pods | "10.2.0.0/16" | "10.22.0.0/16" |
|
| pod_cidr | CIDR IPv4 range to assign to Kubernetes pods | "10.2.0.0/16" | "10.22.0.0/16" |
|
||||||
| service_cidr | CIDR IPv4 range to assign to Kubernetes services | "10.3.0.0/16" | "10.3.0.0/24" |
|
| service_cidr | CIDR IPv4 range to assign to Kubernetes services | "10.3.0.0/16" | "10.3.0.0/24" |
|
||||||
| cluster_domain_suffix | FQDN suffix for Kubernetes services answered by coredns. | "cluster.local" | "k8s.example.com" |
|
| worker_node_labels | List of initial worker node labels | [] | ["worker-pool=default"] |
|
||||||
|
|
||||||
Check the list of valid [machine types](https://cloud.google.com/compute/docs/machine-types).
|
Check the list of valid [machine types](https://cloud.google.com/compute/docs/machine-types).
|
||||||
|
|
||||||
#### Preemption
|
#### Preemption
|
||||||
|
|
||||||
Add `worker_preemeptible = "true"` to allow worker nodes to be [preempted](https://cloud.google.com/compute/docs/instances/preemptible) at random, but pay [significantly](https://cloud.google.com/compute/pricing) less. Clusters tolerate stopping instances fairly well (reschedules pods, but cannot drain) and preemption provides a nice reward for running fault-tolerant cluster systems.`
|
Add `worker_preemptible = "true"` to allow worker nodes to be [preempted](https://cloud.google.com/compute/docs/instances/preemptible) at random, but pay [significantly](https://cloud.google.com/compute/pricing) less. Clusters tolerate stopping instances fairly well (reschedules pods, but cannot drain) and preemption provides a nice reward for running fault-tolerant cluster systems.`
|
||||||
|
|
||||||
|
@ -3,11 +3,11 @@
|
|||||||
!!! danger
|
!!! danger
|
||||||
Typhoon for Fedora CoreOS is an early preview! Fedora CoreOS itself is a preview! Expect bugs and design shifts. Please help both projects solve problems. Report Fedora CoreOS bugs to [Fedora](https://github.com/coreos/fedora-coreos-tracker/issues). Report Typhoon issues to Typhoon.
|
Typhoon for Fedora CoreOS is an early preview! Fedora CoreOS itself is a preview! Expect bugs and design shifts. Please help both projects solve problems. Report Fedora CoreOS bugs to [Fedora](https://github.com/coreos/fedora-coreos-tracker/issues). Report Typhoon issues to Typhoon.
|
||||||
|
|
||||||
In this tutorial, we'll create a Kubernetes v1.15.1 cluster on AWS with Fedora CoreOS.
|
In this tutorial, we'll create a Kubernetes v1.16.1 cluster on AWS with Fedora CoreOS.
|
||||||
|
|
||||||
We'll declare a Kubernetes cluster using the Typhoon Terraform module. Then apply the changes to create a VPC, gateway, subnets, security groups, controller instances, worker auto-scaling group, network load balancer, and TLS assets.
|
We'll declare a Kubernetes cluster using the Typhoon Terraform module. Then apply the changes to create a VPC, gateway, subnets, security groups, controller instances, worker auto-scaling group, network load balancer, and TLS assets.
|
||||||
|
|
||||||
Controllers are provisioned to run an `etcd-member` peer and a `kubelet` service. Workers run just a `kubelet` service. A one-time [bootkube](https://github.com/kubernetes-incubator/bootkube) bootstrap schedules the `apiserver`, `scheduler`, `controller-manager`, and `coredns` on controllers and schedules `kube-proxy` and `calico` (or `flannel`) on every node. A generated `kubeconfig` provides `kubectl` access to the cluster.
|
Controller hosts are provisioned to run an `etcd-member` peer and a `kubelet` service. Worker hosts run a `kubelet` service. Controller nodes run `kube-apiserver`, `kube-scheduler`, `kube-controller-manager`, and `coredns`, while `kube-proxy` and `calico` (or `flannel`) run on every node. A generated `kubeconfig` provides `kubectl` access to the cluster.
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ Install [Terraform](https://www.terraform.io/downloads.html) v0.12.x on your sys
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ terraform version
|
$ terraform version
|
||||||
Terraform v0.12.2
|
Terraform v0.12.9
|
||||||
```
|
```
|
||||||
|
|
||||||
Add the [terraform-provider-ct](https://github.com/poseidon/terraform-provider-ct) plugin binary for your system to `~/.terraform.d/plugins/`, noting the final name.
|
Add the [terraform-provider-ct](https://github.com/poseidon/terraform-provider-ct) plugin binary for your system to `~/.terraform.d/plugins/`, noting the final name.
|
||||||
@ -52,8 +52,8 @@ Configure the AWS provider to use your access key credentials in a `providers.tf
|
|||||||
|
|
||||||
```tf
|
```tf
|
||||||
provider "aws" {
|
provider "aws" {
|
||||||
version = "2.19.0"
|
version = "2.31.0"
|
||||||
region = "us-east-1" # MUST be us-east-1 right now!
|
region = "eu-central-1"
|
||||||
shared_credentials_file = "/home/user/.config/aws/credentials"
|
shared_credentials_file = "/home/user/.config/aws/credentials"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ Define a Kubernetes cluster using the module `aws/fedora-coreos/kubernetes`.
|
|||||||
|
|
||||||
```tf
|
```tf
|
||||||
module "aws-tempest" {
|
module "aws-tempest" {
|
||||||
source = "git::https://github.com/poseidon/typhoon//aws/fedora-coreos/kubernetes?ref=DEVELOPMENT_SHA"
|
source = "git::https://github.com/poseidon/typhoon//aws/fedora-coreos/kubernetes?ref=v1.16.1"
|
||||||
|
|
||||||
# AWS
|
# AWS
|
||||||
cluster_name = "tempest"
|
cluster_name = "tempest"
|
||||||
@ -94,7 +94,7 @@ Reference the [variables docs](#variables) or the [variables.tf](https://github.
|
|||||||
|
|
||||||
## ssh-agent
|
## ssh-agent
|
||||||
|
|
||||||
Initial bootstrapping requires `bootkube.service` be started on one controller node. Terraform uses `ssh-agent` to automate this step. Add your SSH private key to `ssh-agent`.
|
Initial bootstrapping requires `bootstrap.service` be started on one controller node. Terraform uses `ssh-agent` to automate this step. Add your SSH private key to `ssh-agent`.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
ssh-add ~/.ssh/id_rsa
|
ssh-add ~/.ssh/id_rsa
|
||||||
@ -121,9 +121,9 @@ Apply the changes to create the cluster.
|
|||||||
```sh
|
```sh
|
||||||
$ terraform apply
|
$ terraform apply
|
||||||
...
|
...
|
||||||
module.aws-tempest.null_resource.bootkube-start: Still creating... (4m50s elapsed)
|
module.aws-tempest.null_resource.bootstrap: Still creating... (4m50s elapsed)
|
||||||
module.aws-tempest.null_resource.bootkube-start: Still creating... (5m0s elapsed)
|
module.aws-tempest.null_resource.bootstrap: Still creating... (5m0s elapsed)
|
||||||
module.aws-tempest.null_resource.bootkube-start: Creation complete after 11m8s (ID: 3961816482286168143)
|
module.aws-tempest.null_resource.bootstrap: Creation complete after 5m8s (ID: 3961816482286168143)
|
||||||
|
|
||||||
Apply complete! Resources: 98 added, 0 changed, 0 destroyed.
|
Apply complete! Resources: 98 added, 0 changed, 0 destroyed.
|
||||||
```
|
```
|
||||||
@ -137,32 +137,28 @@ In 4-8 minutes, the Kubernetes cluster will be ready.
|
|||||||
```
|
```
|
||||||
$ export KUBECONFIG=/home/user/.secrets/clusters/tempest/auth/kubeconfig
|
$ export KUBECONFIG=/home/user/.secrets/clusters/tempest/auth/kubeconfig
|
||||||
$ kubectl get nodes
|
$ kubectl get nodes
|
||||||
NAME STATUS ROLES AGE VERSION
|
NAME STATUS ROLES AGE VERSION
|
||||||
ip-10-0-3-155 Ready controller,master 10m v1.15.1
|
ip-10-0-3-155 Ready <none> 10m v1.16.1
|
||||||
ip-10-0-26-65 Ready node 10m v1.15.1
|
ip-10-0-26-65 Ready <none> 10m v1.16.1
|
||||||
ip-10-0-41-21 Ready node 10m v1.15.1
|
ip-10-0-41-21 Ready <none> 10m v1.16.1
|
||||||
```
|
```
|
||||||
|
|
||||||
List the pods.
|
List the pods.
|
||||||
|
|
||||||
```
|
```
|
||||||
$ kubectl get pods --all-namespaces
|
$ kubectl get pods --all-namespaces
|
||||||
NAMESPACE NAME READY STATUS RESTARTS AGE
|
NAMESPACE NAME READY STATUS RESTARTS AGE
|
||||||
kube-system calico-node-1m5bf 2/2 Running 0 34m
|
kube-system calico-node-1m5bf 2/2 Running 0 34m
|
||||||
kube-system calico-node-7jmr1 2/2 Running 0 34m
|
kube-system calico-node-7jmr1 2/2 Running 0 34m
|
||||||
kube-system calico-node-bknc8 2/2 Running 0 34m
|
kube-system calico-node-bknc8 2/2 Running 0 34m
|
||||||
kube-system coredns-1187388186-wx1lg 1/1 Running 0 34m
|
kube-system coredns-1187388186-wx1lg 1/1 Running 0 34m
|
||||||
kube-system coredns-1187388186-qjnvp 1/1 Running 0 34m
|
kube-system coredns-1187388186-qjnvp 1/1 Running 0 34m
|
||||||
kube-system kube-apiserver-4mjbk 1/1 Running 0 34m
|
kube-system kube-apiserver-ip-10-0-3-155 1/1 Running 0 34m
|
||||||
kube-system kube-controller-manager-3597210155-j2jbt 1/1 Running 1 34m
|
kube-system kube-controller-manager-ip-10-0-3-155 1/1 Running 0 34m
|
||||||
kube-system kube-controller-manager-3597210155-j7g7x 1/1 Running 0 34m
|
kube-system kube-proxy-14wxv 1/1 Running 0 34m
|
||||||
kube-system kube-proxy-14wxv 1/1 Running 0 34m
|
kube-system kube-proxy-9vxh2 1/1 Running 0 34m
|
||||||
kube-system kube-proxy-9vxh2 1/1 Running 0 34m
|
kube-system kube-proxy-sbbsh 1/1 Running 0 34m
|
||||||
kube-system kube-proxy-sbbsh 1/1 Running 0 34m
|
kube-system kube-scheduler-ip-10-0-3-155 1/1 Running 1 34m
|
||||||
kube-system kube-scheduler-3359497473-5plhf 1/1 Running 0 34m
|
|
||||||
kube-system kube-scheduler-3359497473-r7zg7 1/1 Running 1 34m
|
|
||||||
kube-system pod-checkpointer-4kxtl 1/1 Running 0 34m
|
|
||||||
kube-system pod-checkpointer-4kxtl-ip-10-0-3-155 1/1 Running 0 33m
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Going Further
|
## Going Further
|
||||||
@ -195,7 +191,7 @@ resource "aws_route53_zone" "zone-for-clusters" {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Reference the DNS zone id with `"${aws_route53_zone.zone-for-clusters.zone_id}"`.
|
Reference the DNS zone id with `aws_route53_zone.zone-for-clusters.zone_id`.
|
||||||
|
|
||||||
!!! tip ""
|
!!! tip ""
|
||||||
If you have an existing domain name with a zone file elsewhere, just delegate a subdomain that can be managed on Route53 (e.g. aws.mydomain.com) and [update nameservers](http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/SOA-NSrecords.html).
|
If you have an existing domain name with a zone file elsewhere, just delegate a subdomain that can be managed on Route53 (e.g. aws.mydomain.com) and [update nameservers](http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/SOA-NSrecords.html).
|
||||||
@ -209,11 +205,11 @@ Reference the DNS zone id with `"${aws_route53_zone.zone-for-clusters.zone_id}"`
|
|||||||
| controller_type | EC2 instance type for controllers | "t3.small" | See below |
|
| controller_type | EC2 instance type for controllers | "t3.small" | See below |
|
||||||
| worker_type | EC2 instance type for workers | "t3.small" | See below |
|
| worker_type | EC2 instance type for workers | "t3.small" | See below |
|
||||||
| os_image | AMI channel for Fedora CoreOS | not yet used | ? |
|
| os_image | AMI channel for Fedora CoreOS | not yet used | ? |
|
||||||
| disk_size | Size of the EBS volume in GB | "40" | "100" |
|
| disk_size | Size of the EBS volume in GB | 40 | 100 |
|
||||||
| disk_type | Type of the EBS volume | "gp2" | standard, gp2, io1 |
|
| disk_type | Type of the EBS volume | "gp2" | standard, gp2, io1 |
|
||||||
| disk_iops | IOPS of the EBS volume | "0" (i.e. auto) | "400" |
|
| disk_iops | IOPS of the EBS volume | 0 (i.e. auto) | 400 |
|
||||||
| worker_target_groups | Target group ARNs to which worker instances should be added | [] | ["${aws_lb_target_group.app.id}"] |
|
| worker_target_groups | Target group ARNs to which worker instances should be added | [] | [aws_lb_target_group.app.id] |
|
||||||
| worker_price | Spot price in USD for workers. Leave as default empty string for regular on-demand instances | "" | "0.10" |
|
| worker_price | Spot price in USD for worker instances or 0 to use on-demand instances | 0 | 0.10 |
|
||||||
| controller_snippets | Controller Fedora CoreOS Config snippets | [] | UNSUPPORTED |
|
| controller_snippets | Controller Fedora CoreOS Config snippets | [] | UNSUPPORTED |
|
||||||
| worker_clc_snippets | Worker Fedora CoreOS Config snippets | [] | UNSUPPORTED |
|
| worker_clc_snippets | Worker Fedora CoreOS Config snippets | [] | UNSUPPORTED |
|
||||||
| networking | Choice of networking provider | "calico" | "calico" or "flannel" |
|
| networking | Choice of networking provider | "calico" | "calico" or "flannel" |
|
||||||
@ -221,7 +217,7 @@ Reference the DNS zone id with `"${aws_route53_zone.zone-for-clusters.zone_id}"`
|
|||||||
| host_cidr | CIDR IPv4 range to assign to EC2 instances | "10.0.0.0/16" | "10.1.0.0/16" |
|
| host_cidr | CIDR IPv4 range to assign to EC2 instances | "10.0.0.0/16" | "10.1.0.0/16" |
|
||||||
| pod_cidr | CIDR IPv4 range to assign to Kubernetes pods | "10.2.0.0/16" | "10.22.0.0/16" |
|
| pod_cidr | CIDR IPv4 range to assign to Kubernetes pods | "10.2.0.0/16" | "10.22.0.0/16" |
|
||||||
| service_cidr | CIDR IPv4 range to assign to Kubernetes services | "10.3.0.0/16" | "10.3.0.0/24" |
|
| service_cidr | CIDR IPv4 range to assign to Kubernetes services | "10.3.0.0/16" | "10.3.0.0/24" |
|
||||||
| cluster_domain_suffix | FQDN suffix for Kubernetes services answered by coredns. | "cluster.local" | "k8s.example.com" |
|
| worker_node_labels | List of initial worker node labels | [] | ["worker-pool=default"] |
|
||||||
|
|
||||||
Check the list of valid [instance types](https://aws.amazon.com/ec2/instance-types/).
|
Check the list of valid [instance types](https://aws.amazon.com/ec2/instance-types/).
|
||||||
|
|
||||||
|
@ -3,11 +3,11 @@
|
|||||||
!!! danger
|
!!! danger
|
||||||
Typhoon for Fedora CoreOS is an early preview! Fedora CoreOS itself is a preview! Expect bugs and design shifts. Please help both projects solve problems. Report Fedora CoreOS bugs to [Fedora](https://github.com/coreos/fedora-coreos-tracker/issues). Report Typhoon issues to Typhoon.
|
Typhoon for Fedora CoreOS is an early preview! Fedora CoreOS itself is a preview! Expect bugs and design shifts. Please help both projects solve problems. Report Fedora CoreOS bugs to [Fedora](https://github.com/coreos/fedora-coreos-tracker/issues). Report Typhoon issues to Typhoon.
|
||||||
|
|
||||||
In this tutorial, we'll network boot and provision a Kubernetes v1.15.1 cluster on bare-metal with Fedora CoreOS.
|
In this tutorial, we'll network boot and provision a Kubernetes v1.16.1 cluster on bare-metal with Fedora CoreOS.
|
||||||
|
|
||||||
First, we'll deploy a [Matchbox](https://github.com/poseidon/matchbox) service and setup a network boot environment. Then, we'll declare a Kubernetes cluster using the Typhoon Terraform module and power on machines. On PXE boot, machines will install Fedora CoreOS to disk, reboot into the disk install, and provision themselves as Kubernetes controllers or workers via Ignition.
|
First, we'll deploy a [Matchbox](https://github.com/poseidon/matchbox) service and setup a network boot environment. Then, we'll declare a Kubernetes cluster using the Typhoon Terraform module and power on machines. On PXE boot, machines will install Fedora CoreOS to disk, reboot into the disk install, and provision themselves as Kubernetes controllers or workers via Ignition.
|
||||||
|
|
||||||
Controllers are provisioned to run an `etcd-member` peer and a `kubelet` service. Workers run just a `kubelet` service. A one-time [bootkube](https://github.com/kubernetes-incubator/bootkube) bootstrap schedules the `apiserver`, `scheduler`, `controller-manager`, and `coredns` on controllers and schedules `kube-proxy` and `calico` (or `flannel`) on every node. A generated `kubeconfig` provides `kubectl` access to the cluster.
|
Controller hosts are provisioned to run an `etcd-member` peer and a `kubelet` service. Worker hosts run a `kubelet` service. Controller nodes run `kube-apiserver`, `kube-scheduler`, `kube-controller-manager`, and `coredns`, while `kube-proxy` and `calico` (or `flannel`) run on every node. A generated `kubeconfig` provides `kubectl` access to the cluster.
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ Read about the [many ways](https://coreos.com/matchbox/docs/latest/network-setup
|
|||||||
TFTP chainloading to modern boot firmware, like iPXE, avoids issues with old NICs and allows faster transfer protocols like HTTP to be used.
|
TFTP chainloading to modern boot firmware, like iPXE, avoids issues with old NICs and allows faster transfer protocols like HTTP to be used.
|
||||||
|
|
||||||
!!! warning
|
!!! warning
|
||||||
Compile iPXE from [source](https://github.com/ipxe/ipxe) with support for [HTTPS downloads](https://ipxe.org/crypto). iPXE's pre-built firmware binaries do not enable this. If you cannot enable HTTPS downloads, set `download_protocol = "http"` (discouraged).
|
Compile iPXE from [source](https://github.com/ipxe/ipxe) with support for [HTTPS downloads](https://ipxe.org/crypto). iPXE's pre-built firmware binaries do not enable this. Fedora does not provide images over HTTP.
|
||||||
|
|
||||||
## Terraform Setup
|
## Terraform Setup
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ Install [Terraform](https://www.terraform.io/downloads.html) v0.12.x on your sys
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ terraform version
|
$ terraform version
|
||||||
Terraform v0.12.2
|
Terraform v0.12.9
|
||||||
```
|
```
|
||||||
|
|
||||||
Add the [terraform-provider-matchbox](https://github.com/poseidon/terraform-provider-matchbox) plugin binary for your system to `~/.terraform.d/plugins/`, noting the final name.
|
Add the [terraform-provider-matchbox](https://github.com/poseidon/terraform-provider-matchbox) plugin binary for your system to `~/.terraform.d/plugins/`, noting the final name.
|
||||||
@ -147,9 +147,9 @@ Configure the Matchbox provider to use your Matchbox API endpoint and client cer
|
|||||||
provider "matchbox" {
|
provider "matchbox" {
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
endpoint = "matchbox.example.com:8081"
|
endpoint = "matchbox.example.com:8081"
|
||||||
client_cert = "${file("~/.config/matchbox/client.crt")}"
|
client_cert = file("~/.config/matchbox/client.crt")
|
||||||
client_key = "${file("~/.config/matchbox/client.key")}"
|
client_key = file("~/.config/matchbox/client.key")
|
||||||
ca = "${file("~/.config/matchbox/ca.crt")}"
|
ca = file("~/.config/matchbox/ca.crt")
|
||||||
}
|
}
|
||||||
|
|
||||||
provider "ct" {
|
provider "ct" {
|
||||||
@ -163,14 +163,14 @@ Define a Kubernetes cluster using the module `bare-metal/fedora-coreos/kubernete
|
|||||||
|
|
||||||
```tf
|
```tf
|
||||||
module "bare-metal-mercury" {
|
module "bare-metal-mercury" {
|
||||||
source = "git::https://github.com/poseidon/typhoon//bare-metal/fedora-coreos/kubernetes?ref=DEVELOPMENT_SHA"
|
source = "git::https://github.com/poseidon/typhoon//bare-metal/fedora-coreos/kubernetes?ref=v1.16.1"
|
||||||
|
|
||||||
# bare-metal
|
# bare-metal
|
||||||
cluster_name = "mercury"
|
cluster_name = "mercury"
|
||||||
matchbox_http_endpoint = "http://matchbox.example.com"
|
matchbox_http_endpoint = "http://matchbox.example.com"
|
||||||
os_stream = "testing"
|
os_stream = "testing"
|
||||||
os_version = "30.20190716.1"
|
os_version = "30.20191002.0"
|
||||||
cached_install = false
|
cached_install = true
|
||||||
|
|
||||||
# configuration
|
# configuration
|
||||||
k8s_domain_name = "node1.example.com"
|
k8s_domain_name = "node1.example.com"
|
||||||
@ -200,7 +200,7 @@ Reference the [variables docs](#variables) or the [variables.tf](https://github.
|
|||||||
|
|
||||||
## ssh-agent
|
## ssh-agent
|
||||||
|
|
||||||
Initial bootstrapping requires `bootkube.service` be started on one controller node. Terraform uses `ssh-agent` to automate this step. Add your SSH private key to `ssh-agent`.
|
Initial bootstrapping requires `bootstrap.service` be started on one controller node. Terraform uses `ssh-agent` to automate this step. Add your SSH private key to `ssh-agent`.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
ssh-add ~/.ssh/id_rsa
|
ssh-add ~/.ssh/id_rsa
|
||||||
@ -222,7 +222,7 @@ $ terraform plan
|
|||||||
Plan: 55 to add, 0 to change, 0 to destroy.
|
Plan: 55 to add, 0 to change, 0 to destroy.
|
||||||
```
|
```
|
||||||
|
|
||||||
Apply the changes. Terraform will generate bootkube assets to `asset_dir` and create Matchbox profiles (e.g. controller, worker) and matching rules via the Matchbox API.
|
Apply the changes. Terraform will generate bootstrap assets to `asset_dir` and create Matchbox profiles (e.g. controller, worker) and matching rules via the Matchbox API.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ terraform apply
|
$ terraform apply
|
||||||
@ -251,14 +251,14 @@ Machines will network boot, install Fedora CoreOS to disk, reboot into the disk
|
|||||||
|
|
||||||
### Bootstrap
|
### Bootstrap
|
||||||
|
|
||||||
Wait for the `bootkube-start` step to finish bootstrapping the Kubernetes control plane. This may take 5-15 minutes depending on your network.
|
Wait for the `bootstrap` step to finish bootstrapping the Kubernetes control plane. This may take 5-15 minutes depending on your network.
|
||||||
|
|
||||||
```
|
```
|
||||||
module.bare-metal-mercury.null_resource.bootkube-start: Still creating... (6m10s elapsed)
|
module.bare-metal-mercury.null_resource.bootstrap: Still creating... (6m10s elapsed)
|
||||||
module.bare-metal-mercury.null_resource.bootkube-start: Still creating... (6m20s elapsed)
|
module.bare-metal-mercury.null_resource.bootstrap: Still creating... (6m20s elapsed)
|
||||||
module.bare-metal-mercury.null_resource.bootkube-start: Still creating... (6m30s elapsed)
|
module.bare-metal-mercury.null_resource.bootstrap: Still creating... (6m30s elapsed)
|
||||||
module.bare-metal-mercury.null_resource.bootkube-start: Still creating... (6m40s elapsed)
|
module.bare-metal-mercury.null_resource.bootstrap: Still creating... (6m40s elapsed)
|
||||||
module.bare-metal-mercury.null_resource.bootkube-start: Creation complete (ID: 5441741360626669024)
|
module.bare-metal-mercury.null_resource.bootstrap: Creation complete (ID: 5441741360626669024)
|
||||||
|
|
||||||
Apply complete! Resources: 55 added, 0 changed, 0 destroyed.
|
Apply complete! Resources: 55 added, 0 changed, 0 destroyed.
|
||||||
```
|
```
|
||||||
@ -267,13 +267,12 @@ To watch the bootstrap process in detail, SSH to the first controller and journa
|
|||||||
|
|
||||||
```
|
```
|
||||||
$ ssh core@node1.example.com
|
$ ssh core@node1.example.com
|
||||||
$ journalctl -f -u bootkube
|
$ journalctl -f -u bootstrap
|
||||||
bootkube[5]: Pod Status: pod-checkpointer Running
|
podman[1750]: The connection to the server cluster.example.com:6443 was refused - did you specify the right host or port?
|
||||||
bootkube[5]: Pod Status: kube-apiserver Running
|
podman[1750]: Waiting for static pod control plane
|
||||||
bootkube[5]: Pod Status: kube-scheduler Running
|
...
|
||||||
bootkube[5]: Pod Status: kube-controller-manager Running
|
podman[1750]: serviceaccount/calico-node unchanged
|
||||||
bootkube[5]: All self-hosted control plane components successfully started
|
systemd[1]: Started Kubernetes control plane.
|
||||||
bootkube[5]: Tearing down temporary bootstrap control plane...
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Verify
|
## Verify
|
||||||
@ -283,10 +282,10 @@ bootkube[5]: Tearing down temporary bootstrap control plane...
|
|||||||
```
|
```
|
||||||
$ export KUBECONFIG=/home/user/.secrets/clusters/mercury/auth/kubeconfig
|
$ export KUBECONFIG=/home/user/.secrets/clusters/mercury/auth/kubeconfig
|
||||||
$ kubectl get nodes
|
$ kubectl get nodes
|
||||||
NAME STATUS ROLES AGE VERSION
|
NAME STATUS ROLES AGE VERSION
|
||||||
node1.example.com Ready controller,master 10m v1.15.1
|
node1.example.com Ready <none> 10m v1.16.1
|
||||||
node2.example.com Ready node 10m v1.15.1
|
node2.example.com Ready <none> 10m v1.16.1
|
||||||
node3.example.com Ready node 10m v1.15.1
|
node3.example.com Ready <none> 10m v1.16.1
|
||||||
```
|
```
|
||||||
|
|
||||||
List the pods.
|
List the pods.
|
||||||
@ -299,16 +298,12 @@ kube-system calico-node-gnjrm 2/2 Running 0
|
|||||||
kube-system calico-node-llbgt 2/2 Running 0 11m
|
kube-system calico-node-llbgt 2/2 Running 0 11m
|
||||||
kube-system coredns-1187388186-dj3pd 1/1 Running 0 11m
|
kube-system coredns-1187388186-dj3pd 1/1 Running 0 11m
|
||||||
kube-system coredns-1187388186-mx9rt 1/1 Running 0 11m
|
kube-system coredns-1187388186-mx9rt 1/1 Running 0 11m
|
||||||
kube-system kube-apiserver-7336w 1/1 Running 0 11m
|
kube-system kube-apiserver-node1.example.com 1/1 Running 0 11m
|
||||||
kube-system kube-controller-manager-3271970485-b9chx 1/1 Running 0 11m
|
kube-system kube-controller-manager-node1.example.com 1/1 Running 1 11m
|
||||||
kube-system kube-controller-manager-3271970485-v30js 1/1 Running 1 11m
|
|
||||||
kube-system kube-proxy-50sd4 1/1 Running 0 11m
|
kube-system kube-proxy-50sd4 1/1 Running 0 11m
|
||||||
kube-system kube-proxy-bczhp 1/1 Running 0 11m
|
kube-system kube-proxy-bczhp 1/1 Running 0 11m
|
||||||
kube-system kube-proxy-mp2fw 1/1 Running 0 11m
|
kube-system kube-proxy-mp2fw 1/1 Running 0 11m
|
||||||
kube-system kube-scheduler-3895335239-fd3l7 1/1 Running 1 11m
|
kube-system kube-scheduler-node1.example.com 1/1 Running 0 11m
|
||||||
kube-system kube-scheduler-3895335239-hfjv0 1/1 Running 0 11m
|
|
||||||
kube-system pod-checkpointer-wf65d 1/1 Running 0 11m
|
|
||||||
kube-system pod-checkpointer-wf65d-node1.example.com 1/1 Running 0 11m
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Going Further
|
## Going Further
|
||||||
@ -323,10 +318,10 @@ Check the [variables.tf](https://github.com/poseidon/typhoon/blob/master/bare-me
|
|||||||
|
|
||||||
| Name | Description | Example |
|
| Name | Description | Example |
|
||||||
|:-----|:------------|:--------|
|
|:-----|:------------|:--------|
|
||||||
| cluster_name | Unique cluster name | mercury |
|
| cluster_name | Unique cluster name | "mercury" |
|
||||||
| matchbox_http_endpoint | Matchbox HTTP read-only endpoint | http://matchbox.example.com:port |
|
| matchbox_http_endpoint | Matchbox HTTP read-only endpoint | "http://matchbox.example.com:port" |
|
||||||
| os_stream | Fedora CoreOS release stream | testing |
|
| os_stream | Fedora CoreOS release stream | "testing" |
|
||||||
| os_version | Fedora CoreOS version to PXE and install | 30.20190716.1 |
|
| os_version | Fedora CoreOS version to PXE and install | "30.20190716.1" |
|
||||||
| k8s_domain_name | FQDN resolving to the controller(s) nodes. Workers and kubectl will communicate with this endpoint | "myk8s.example.com" |
|
| k8s_domain_name | FQDN resolving to the controller(s) nodes. Workers and kubectl will communicate with this endpoint | "myk8s.example.com" |
|
||||||
| ssh_authorized_key | SSH public key for user 'core' | "ssh-rsa AAAAB3Nz..." |
|
| ssh_authorized_key | SSH public key for user 'core' | "ssh-rsa AAAAB3Nz..." |
|
||||||
| asset_dir | Absolute path to a directory where generated assets should be placed (contains secrets) | "/home/user/.secrets/clusters/mercury" |
|
| asset_dir | Absolute path to a directory where generated assets should be placed (contains secrets) | "/home/user/.secrets/clusters/mercury" |
|
||||||
@ -346,9 +341,8 @@ Check the [variables.tf](https://github.com/poseidon/typhoon/blob/master/bare-me
|
|||||||
| networking | Choice of networking provider | "calico" | "calico" or "flannel" |
|
| networking | Choice of networking provider | "calico" | "calico" or "flannel" |
|
||||||
| network_mtu | CNI interface MTU (calico-only) | 1480 | - |
|
| network_mtu | CNI interface MTU (calico-only) | 1480 | - |
|
||||||
| snippets | Map from machine names to lists of Fedora CoreOS Config snippets | {} | UNSUPPORTED |
|
| snippets | Map from machine names to lists of Fedora CoreOS Config snippets | {} | UNSUPPORTED |
|
||||||
| network_ip_autodetection_method | Method to detect host IPv4 address (calico-only) | first-found | can-reach=10.0.0.1 |
|
| network_ip_autodetection_method | Method to detect host IPv4 address (calico-only) | "first-found" | "can-reach=10.0.0.1" |
|
||||||
| pod_cidr | CIDR IPv4 range to assign to Kubernetes pods | "10.2.0.0/16" | "10.22.0.0/16" |
|
| pod_cidr | CIDR IPv4 range to assign to Kubernetes pods | "10.2.0.0/16" | "10.22.0.0/16" |
|
||||||
| service_cidr | CIDR IPv4 range to assign to Kubernetes services | "10.3.0.0/16" | "10.3.0.0/24" |
|
| service_cidr | CIDR IPv4 range to assign to Kubernetes services | "10.3.0.0/16" | "10.3.0.0/24" |
|
||||||
| cluster_domain_suffix | FQDN suffix for Kubernetes services answered by coredns. | "cluster.local" | "k8s.example.com" |
|
| kernel_args | Additional kernel args to provide at PXE boot | [] | ["kvm-intel.nested=1"] |
|
||||||
| kernel_args | Additional kernel args to provide at PXE boot | [] | "kvm-intel.nested=1" |
|
|
||||||
|
|
||||||
|
BIN
docs/img/typhoon-aws-load-balancing.png
Normal file
BIN
docs/img/typhoon-aws-load-balancing.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 38 KiB |
BIN
docs/img/typhoon-azure-load-balancing.png
Normal file
BIN
docs/img/typhoon-azure-load-balancing.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 39 KiB |
BIN
docs/img/typhoon-digitalocean-load-balancing.png
Normal file
BIN
docs/img/typhoon-digitalocean-load-balancing.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 49 KiB |
BIN
docs/img/typhoon-gcp-load-balancing.png
Normal file
BIN
docs/img/typhoon-gcp-load-balancing.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 69 KiB |
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user