oc-deploy/ansible/README.md

86 lines
2.3 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Login : admrescue/admrescue
# Requirement
**Ansible** (+ pip):
If you don't have `pip` yet
```
curl https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py
python3 /tmp/get-pip.py --user
```
```
python3 -m pip install --user ansible
pip install -r requirement.txt
```
**Ansible collections**:
```
ansible-galaxy collection install kubernetes.core
```
# Mosquitto
`sudo apt update && apt install -y mosquitto mosquitto-clients`
need to add a conf file in `/etc/mosquitto/conf.d/mosquitto.conf` containing :
```
allow_anonymous true
listener 1883 0.0.0.0
```
`sudo systemctl restart mosquitto`
Launch the mosquitto client to receive message on the machine that hosts the mosquitto server : `sudo mosquitto_sub -h 127.0.0.1 -t argo/alpr`
# Argo
## Execute/submite a workflow
```
argo submit PATH_TO_YAML --watch --serviceaccount=argo -n argo
```
# Troubleshoot
## k3s bind to local port
On certain distro you might already have an other mini k8s. A sign of this is k3s being able to install, start but never being stable, restarting non stop.
You should try to see if the port used by k3s are arlready binded :
> sudo netstat -tuln | grep -E '6443|10250'
If those ports are already in use then you should identify which service run behidn them and then stop them and preferably uninstall them.
We have already encountered an instance of `Ubuntu Server` with minikube already installed.
### Remove minikube
```bash
sudo systemctl stop snap.microk8s.daemon-kubelite
sudo systemctl disable snap.microk8s.daemon-kubelite
sudo systemctl restart k3s
```
## Use local container images
We have encountered difficulties declaring container images that correspond to local images (stored in docker.io/library/)
We used a docker hub repository to pull our customized image. For this we need to create a secret holding the login informations to a docker account that has access to this repository, which we then link to the serviceAccount running the workflow :
Create the secret in the argo namespace
```
kubectl create secret docker-registry regcred --docker-username=[DOCKER HUB USERNAME] --docker-password=[DOCKER HUB PASSWORD] -n argo
```
Patch the `argo` serviceAccount to use the secret when pulling image
```
kubectl patch serviceaccount argo -n argo -p '{"imagePullSecrets": [{"name": "regcred"}]}'
```