feat: labels & taints in ansible playbooks

This commit is contained in:
auricom
2021-04-17 10:32:27 +02:00
parent 6aee140129
commit 738e94dc9a
3 changed files with 11 additions and 36 deletions

View File

@@ -36,32 +36,3 @@ gpg --export-secret-keys --armor <GPG_KEY_ID> | kubectl create secret generic so
```bash
sops --encrypt --pgp=<GPG_KEY_ID> --encrypted-regex '^(data|stringData)$' --in-place <FILE_PATH>
```
## Labels nodes
```bash
kubectl taint node k3s-server k3s-controlplane=true:NoSchedule
kubectl label node k3s-worker1 node-role.kubernetes.io/worker=true
kubectl label node k3s-worker2 node-role.kubernetes.io/worker=true
kubectl label node k3s-worker3 node-role.kubernetes.io/worker=true
kubectl annotate node k3s-worker1 node.longhorn.io/default-node-tags='["storage","fast"]'
kubectl annotate node k3s-worker2 node.longhorn.io/default-node-tags='["storage","fast"]'
kubectl annotate node k3s-worker3 node.longhorn.io/default-node-tags='["storage","fast"]'
kubectl annotate node k3s-worker1 node.longhorn.io/create-default-disk='config'
kubectl annotate node k3s-worker2 node.longhorn.io/create-default-disk='config'
kubectl annotate node k3s-worker3 node.longhorn.io/create-default-disk='config'
kubectl annotate node k3s-worker1 node.longhorn.io/default-disks-config=[ { "name":"fast-ssd-disk", "path":"/var/lib/longhorn", "allowScheduling":true, "storageReserved":304857600, "tags":[ "ssd", "fast" ] }]
kubectl annotate node k3s-worker2 node.longhorn.io/default-disks-config=[ { "name":"fast-ssd-disk", "path":"/var/lib/longhorn", "allowScheduling":true, "storageReserved":304857600, "tags":[ "ssd", "fast" ] }]
kubectl annotate node k3s-worker3 node.longhorn.io/default-disks-config=[ { "name":"fast-ssd-disk", "path":"/var/lib/longhorn", "allowScheduling":true, "storageReserved":304857600, "tags":[ "ssd", "fast" ] }]
kubectl annotate node k3s-worker1 k3s-upgrade='true'
kubectl annotate node k3s-worker2 k3s-upgrade='true'
kubectl annotate node k3s-worker3 k3s-upgrade='true'
```
https://github.com/rancher/k3s/issues/1401 for k3s-system deployment

View File

@@ -1,5 +1,4 @@
---
# https://rancher.com/docs/k3s/latest/en/installation/install-options/server-config/
# https://github.com/PyratLabs/ansible-role-k3s#server-control-plane-configuration
@@ -10,13 +9,15 @@ k3s_control_node: true
k3s_server:
node-ip: "{{ ansible_host }}"
docker: false
flannel-backend: 'none' # This needs to be in quotes
flannel-backend: "none" # This needs to be in quotes
disable:
- flannel
- traefik
- servicelb
- metrics-server
- local-storage
- flannel
- traefik
- servicelb
- metrics-server
- local-storage
node-taint:
- "k3s-controlplane=true:NoSchedule"
disable-network-policy: true
disable-cloud-controller: true
write-kubeconfig-mode: "644"

View File

@@ -8,3 +8,6 @@ k3s_control_node: false
# k3s settings for all worker nodes
k3s_agent:
node-ip: "{{ ansible_host }}"
node-label:
- "node-role.kubernetes.io/worker=true"
- "k3s-upgrade=true"