Skip to content

Commit b6ce33a

Browse files
committed
Fixes geerlingguy#1: Final tweaks for the cluster-monitoring setup.
1 parent 03c6d04 commit b6ce33a

File tree

6 files changed

+43
-14
lines changed

6 files changed

+43
-14
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,22 @@ Once that's done, there will be variety of applications running on your cluster:
4848
| Wordpress | http://wordpress.10.0.100.74.nip.io/ | N/A |
4949
| Minecraft | (`kubectl get service -n minecraft`) | See EULA in [Minecraft chart repo](https://github.com/helm/charts/tree/master/stable/minecraft) |
5050
51+
## Caveats
52+
53+
They are a'plenty.
54+
55+
First of all, the configurations in this repository were built for local demonstration purposes. There are some things that are insecure (like storing some database passwords in plain text), and other things that are just plain crazy (like trying to run all the above things on one tiny Pi-based cluster!).
56+
57+
There are a few architectural decisions that were made that are great for 'day one' setup, but if you tried to flex K3s' muscle and drop/replace nodes while the cluster is running, you'd likely start running into some, shall we say, 'fun' problems.
58+
59+
For example, the MariaDB PVCs are tied to the local node on which they were first deployed, and if you do something that results in the MariaDB Deployment to change nodes for the deployed Pod... you may run into warnings like `FailedScheduling: 3 node(s) had volume node affinity conflict.`
60+
61+
Therefore, if you want to use this project as a base, and are planning on doing anything more than a local demo cluster, you are responsible for making changes to support a more production-ready setup, with better security and better configuration of volumes and multi-pod scalability.
62+
63+
To do these things _correctly_ with Kubernetes takes a lot of work. It's usually _very_ easy—maybe deceptively easy—to get something working. It's harder to get it working reliably in an automated fashion when rebuilding the cluster from scratch (that's about the level where this repository is). And harder still is getting it working reliably with easy maintenance, fault-tolerance, and scalability.
64+
65+
Kubernetes is no substitute for a thorough knowledge of system architecture and engineering!
66+
5167
## Resetting the cluster
5268
5369
You'll likely want to blow away all the changes you've made in a cluster and start fresh every now and then. If you made a mistake, or something broke terribly, that problem goes away. Or, if you want to make sure you've automated the entire cluster build properly, it's best practice to rebuild a cluster frequently.

roles/cluster_monitoring/defaults/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
# The version of the cluster-monitoring repo to check out. See commits:
33
# https://github.com/carlosedp/cluster-monitoring/commits/master
4-
cluster_monitoring_version: 4ddebeb
4+
cluster_monitoring_version: 5b75c81
55

66
# Whether to force updating the cluster-monitoring repository. Set this to true
77
# if you change the cluster_monitoring_version above.

roles/cluster_monitoring/tasks/main.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
3535
- name: Find all the manifests in the manifests/setup directory.
3636
find:
37-
paths: ~/cluster-monitoring/manifests
37+
paths: ~/cluster-monitoring/manifests/setup
3838
file_type: file
3939
patterns: '*.yaml,*.yml'
4040
register: cluster_monitoring_setup_files
@@ -44,3 +44,16 @@
4444
src: "{{ item }}"
4545
state: present
4646
loop: "{{ cluster_monitoring_setup_files.files | sort(attribute='path') | map(attribute='path') | list }}"
47+
48+
- name: Find all the manifests in the manifests directory.
49+
find:
50+
paths: ~/cluster-monitoring/manifests
51+
file_type: file
52+
patterns: '*.yaml,*.yml'
53+
register: cluster_monitoring_files
54+
55+
- name: Apply cluster-monitoring manifests.
56+
k8s:
57+
src: "{{ item }}"
58+
state: present
59+
loop: "{{ cluster_monitoring_files.files | sort(attribute='path') | map(attribute='path') | list }}"

roles/cluster_monitoring/templates/vars.jsonnet.j2

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,32 @@
88
// After deployment, run the create_gmail_auth.sh script from scripts dir.
99
name: 'smtpRelay',
1010
enabled: false,
11-
file: import 'smtp_relay.jsonnet',
11+
file: import 'modules/smtp_relay.jsonnet',
1212
},
1313
{
1414
name: 'armExporter',
1515
enabled: true,
16-
file: import 'arm_exporter.jsonnet',
16+
file: import 'modules/arm_exporter.jsonnet',
1717
},
1818
{
1919
name: 'upsExporter',
2020
enabled: false,
21-
file: import 'ups_exporter.jsonnet',
21+
file: import 'modules/ups_exporter.jsonnet',
2222
},
2323
{
2424
name: 'metallbExporter',
2525
enabled: false,
26-
file: import 'metallb.jsonnet',
26+
file: import 'modules/metallb.jsonnet',
2727
},
2828
{
2929
name: 'traefikExporter',
3030
enabled: false,
31-
file: import 'traefik.jsonnet',
31+
file: import 'modules/traefik.jsonnet',
3232
},
3333
{
3434
name: 'elasticExporter',
3535
enabled: false,
36-
file: import 'elasticsearch_exporter.jsonnet',
36+
file: import 'modules/elasticsearch_exporter.jsonnet',
3737
},
3838
],
3939

@@ -62,4 +62,4 @@
6262
grafana: {
6363
from_address: 'myemail@example.com',
6464
},
65-
}
65+
}

roles/drupal/files/mariadb.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ spec:
4747
resources:
4848
limits:
4949
cpu: '2'
50-
memory: '768Mi'
50+
memory: '512Mi'
5151
requests:
5252
cpu: '500m'
53-
memory: '512Mi'
53+
memory: '256Mi'
5454
volumes:
5555
- name: database
5656
persistentVolumeClaim:

roles/wordpress/templates/mariadb.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ spec:
6262
mountPath: /var/lib/mariadb
6363
resources:
6464
limits:
65-
cpu: '2'
66-
memory: '768Mi'
65+
cpu: '1'
66+
memory: '512Mi'
6767
requests:
6868
cpu: '500m'
69-
memory: '512Mi'
69+
memory: '256Mi'
7070
volumes:
7171
- name: mariadb-persistent-storage
7272
persistentVolumeClaim:

0 commit comments

Comments
 (0)