traefik-helper-kubernetes/README.md

44 lines
1.3 KiB
Markdown
Raw Permalink Normal View History

2024-09-21 04:42:26 +00:00
# Traefik Helper (for Kubernetes)
This is a helper for [Traefik](https://traefik.io/) on Kubernetes. It allows you to add and delete services from a simple cli.
2024-09-21 04:56:41 +00:00
## Usage
2024-09-21 04:42:26 +00:00
2024-09-21 04:56:41 +00:00
1. Clone the repository
2. Install the dependencies (`pip install -r requirements.txt`)
2024-09-21 04:57:25 +00:00
3. Go to the [Windows Alias](#windows-alias) section
2024-09-21 04:48:44 +00:00
## Windows Alias
Ensure you have ran `Set-ExecutionPolicy Unrestricted` in PowerShell as an administrator.
2024-09-21 05:00:32 +00:00
Create the directory `~/Documents/WindowsPowerShell` and create a file called `Microsoft.PowerShell_profile.ps1` in that directory. Add the following code to the file. Below is an example on how to run the `traefik` command in PowerShell.
2024-09-21 04:48:44 +00:00
```bash
function Traefik-Helper {
2024-09-21 04:56:41 +00:00
$helperPath = "C:\Users\Liam\Desktop\Projects\traefik-helper-kubernetes"
# Set the static environment variable
$env:SERVICES_PATH = "c:\Users\Liam\Nextcloud\Kubernetes\traefik\external"
# Convert the arguments to a string
2024-09-21 04:48:44 +00:00
$argsAsString = $args -join ' '
2024-09-21 04:56:41 +00:00
# Construct the command
$command = "python $helperPath\app.py $argsAsString"
2024-09-21 04:48:44 +00:00
2024-09-21 04:56:41 +00:00
# Run the command with the environment variable
2024-09-21 04:48:44 +00:00
Invoke-Expression $command
}
# Set the alias
Set-Alias -Name "traefik" -Value "Traefik-Helper"
2024-09-21 04:56:41 +00:00
2024-09-21 04:48:44 +00:00
```
This will allow you to run the `traefik` command in PowerShell.
2024-09-21 04:56:41 +00:00
## Todo
- [ ] Use the Traefik api to list all services