71 lines
2.4 KiB
Markdown
71 lines
2.4 KiB
Markdown
|
# Prerequisites
|
||
|
Ensure that you have the following installed on your local machine:
|
||
|
- Ansible
|
||
|
- SSH access to the target host
|
||
|
- Required dependencies for Kubernetes
|
||
|
|
||
|
Two passwords are required via the prompt:
|
||
|
1. The username used to connect to the host via SSH.
|
||
|
2. The root password for privilege escalation.
|
||
|
|
||
|
- You can use a user on the name with `NOPASSWD` permissions and not use `--ask-become-pass`
|
||
|
|
||
|
- You can use `ssh-copy-id` on the remote host on the user that you will provide and not use `--ask-pass`
|
||
|
|
||
|
|
||
|
# Deployment Instructions
|
||
|
|
||
|
## Deploying K3s
|
||
|
Replace `HOST_NAME` with the IP address or hostname of the target machine in `my_hosts.yaml`, then run:
|
||
|
|
||
|
```sh
|
||
|
ansible-playbook -i <YOUR_HOST_IP>, deploy_k3s.yml --extra-vars "user_prompt=YOUR_USER" --ask-pass --ask-become-pass
|
||
|
```
|
||
|
|
||
|
This playbook:
|
||
|
- Updates package repositories.
|
||
|
- Installs necessary dependencies.
|
||
|
- Ensures the user has `sudo` privileges.
|
||
|
- Downloads and installs K3s.
|
||
|
- Configures permissions for Kubernetes operations.
|
||
|
- Enables auto-completion for `kubectl`.
|
||
|
- Reboots the machine to apply changes.
|
||
|
|
||
|
## Deploying Argo Workflows
|
||
|
Replace `HOST_NAME` with the IP address or hostname of the target machine in `my_hosts.yaml`, then run:
|
||
|
|
||
|
```sh
|
||
|
ansible-playbook -i <YOUR_HOST_IP>, deploy_argo.yml --extra-vars "user_prompt=<YOUR_USER>" --ask-pass --ask-become-pass
|
||
|
```
|
||
|
|
||
|
This playbook:
|
||
|
- Ensures the `argo` namespace exists in Kubernetes.
|
||
|
- Deploys Argo Workflows using the official manifest.
|
||
|
- Waits for the `argo-server` pod to be running.
|
||
|
- Patches the deployment for first-time connection issues.
|
||
|
- Applies a service configuration to expose Argo Workflows via NodePort.
|
||
|
- Installs the Argo CLI.
|
||
|
- Enables CLI autocompletion.
|
||
|
- Configures `kubectl` for Argo access.
|
||
|
|
||
|
# Additional Notes
|
||
|
- The service account used by default is `argo:default`, which may not have sufficient permissions. Use `argo:argo` instead:
|
||
|
```sh
|
||
|
argo submit -f workflow.yaml --serviceaccount=argo
|
||
|
```
|
||
|
- The Argo CLI is installed in `/usr/local/bin/argo`.
|
||
|
- The Kubernetes configuration file is copied to `~/.kube/config`.
|
||
|
|
||
|
# Troubleshooting
|
||
|
- If the deployment fails due to permissions, ensure the user has `sudo` privileges.
|
||
|
- Check the status of Argo pods using:
|
||
|
```sh
|
||
|
kubectl get pods -n argo
|
||
|
```
|
||
|
- If Argo Workflows is not accessible, verify that the NodePort service is correctly configured.
|
||
|
|
||
|
# References
|
||
|
- [K3s Official Documentation](https://k3s.io/)
|
||
|
- [Argo Workflows Documentation](https://argoproj.github.io/argo-workflows/)
|
||
|
|