Hello,
I am newbie to K3s so, this might be a dumb question.
I am working on an Ansible playbook to standup a single node K3s, validate it is operational, & then install a 3rd-party pod.
The issue I am running into is the validate operations. The big questions I have is:
- I need a list of ‘expected’ pods (inventory) prior to deployment. Does this information exists somewhere?
- How do I know all the expected pods have been initialized before continuing with any operation?
Currently, the playbook will:
- deploy the K3s via https://get.k3s.io
- wait for 60 secs
- run the equivalent of 'kubectl get pods -all-namespaces [uses the kubernetes.core module]
- parse the above output for only the pod full names (minus the helm-install-traefik)
- should result in the following pods
- local-path-provisioner-{{uid}}
- coredns-{{uid}}
- metrics-server-{{uid}}
- svclb-traefik-{{uid}}
- traefik-{{uid}}
- should result in the following pods
- loop through the above list and wait for each pod to be in a ‘running’ state
The problem with this solution is:
- No idea how many pods are to be expected
- Without an “inventory matrix”, no way to validate.
- If I hardcode the names, then any changes to the base install pods will break the workflow.
Solution (if something possible or already exists):
- Read a single file with list each scenario and the associated pods
- Single node deployment
- pod#1
- pod#2
- pod#3
- Cluster node deployment
- All pods of single node
- pod#4
- Single node deployment
OR
Have Ansible read any appropriate manifest files to parse the base name of the pod and build the inventory matrix (list).
Any suggestions would be helpful.
Tx