Re-bringup
This commit is contained in:
parent
311264a95e
commit
5af5994e64
|
@ -49,7 +49,7 @@
|
|||
src: /var/lib/rancher/k3s/server/node-token
|
||||
register: slurped_k3s_node_token
|
||||
|
||||
- name: set token fact
|
||||
- name: set token fact for initial node
|
||||
set_fact:
|
||||
k3s_node_token: '{{ slurped_k3s_node_token.content | b64decode }}'
|
||||
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
# [lyte.dev](https://lyte.dev)
|
20
ansible/inventory/hosts.yml
Normal file
20
ansible/inventory/hosts.yml
Normal file
|
@ -0,0 +1,20 @@
|
|||
k3s-nodes:
|
||||
hosts:
|
||||
"root@10.0.0.87":
|
||||
"root@10.0.0.138":
|
||||
|
||||
vars:
|
||||
ansible_python_interpreter: /usr/bin/python3.10
|
||||
k3s:
|
||||
version: v1.23.3+k3s1
|
||||
|
||||
k3s-control-nodes:
|
||||
hosts:
|
||||
"root@10.0.0.87":
|
||||
|
||||
k3s-agent-nodes:
|
||||
hosts:
|
||||
"root@10.0.0.138":
|
||||
|
||||
vars:
|
||||
k3s_command: agent
|
|
@ -1,38 +0,0 @@
|
|||
Role Name
|
||||
=========
|
||||
|
||||
A brief description of the role goes here.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
|
||||
|
||||
Role Variables
|
||||
--------------
|
||||
|
||||
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
|
||||
|
||||
Example Playbook
|
||||
----------------
|
||||
|
||||
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
||||
|
||||
- hosts: servers
|
||||
roles:
|
||||
- { role: username.rolename, x: 42 }
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
BSD
|
||||
|
||||
Author Information
|
||||
------------------
|
||||
|
||||
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
|
|
@ -1,5 +1,5 @@
|
|||
- name: purge k3s from k3s-nodes
|
||||
hosts: all
|
||||
hosts: k3s-nodes
|
||||
become: true
|
||||
gather_facts: no
|
||||
any_errors_fatal: true
|
||||
|
|
11
readme.md
11
readme.md
|
@ -45,18 +45,19 @@ Before we interact with the cluster, we have some manual work to do.
|
|||
And the cluster is up! If you want to interact with it from your controller,
|
||||
you can do this:
|
||||
|
||||
- Copy the cluster information from the `./k3s-cluster-config.kubeconfig.yaml` file into
|
||||
your existing `~/.kube/config` (or just copy it there if it doesn't exist)
|
||||
- You will need to edit the host from `localhost`/`127.0.0.1` to the correct host
|
||||
|
||||
```bash
|
||||
ansible -i ansible/inventory/hosts.yml $REMOTE_HOST -m fetch \
|
||||
-a "src=/etc/rancher/k3s/k3s.yaml dest=./k3s-cluster-config.kubeconfig.yaml flat=yes"
|
||||
# TODO: this did not work for me
|
||||
# env KUBECONFIG="~/.kube/config:./k3s-cluster-config.kubeconfig.yaml" \
|
||||
# kubectl config view --flatten | sed "s/127.0.0.1/$REMOTE_HOST/" > ~/.kube/new-config
|
||||
sed -i 's/127\.0\.0\.1/10.0.0.87' ~/.kube/config
|
||||
```
|
||||
|
||||
- Copy the cluster information from the `./k3s-cluster-config.kubeconfig.yaml` file into
|
||||
your existing `~/.kube/config` (or just copy it there if it doesn't exist)
|
||||
- You will need to edit the host from `localhost`/`127.0.0.1` to the correct host
|
||||
|
||||
### Automated Teardown
|
||||
|
||||
```bash
|
||||
|
@ -75,7 +76,7 @@ ansible-playbook -i inventory/hosts.yml ./nuke-k3s-cluster
|
|||
- `kubectl create namespace flux-system --dry-run=client -o yaml | kubectl apply -f -`
|
||||
- Add the `sops-age` encryption key to the namespace
|
||||
```bash
|
||||
pass home-k8s-cluster | grep age-secret-key | awk '{printf $2}' | \
|
||||
pass k8s-clusters | grep age-secret-key | awk '{printf $2}' | \
|
||||
kubectl --namespace flux-system create secret generic sops-age \
|
||||
--from-file=age.agekey=/dev/stdin
|
||||
```
|
||||
|
|
Loading…
Reference in a new issue