44 lines
1.3 KiB
Markdown
44 lines
1.3 KiB
Markdown
# 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.
|
|
|
|
## Usage
|
|
|
|
1. Clone the repository
|
|
2. Install the dependencies (`pip install -r requirements.txt`)
|
|
3. Go to the [Windows Alias](#windows-alias) section
|
|
|
|
## Windows Alias
|
|
|
|
Ensure you have ran `Set-ExecutionPolicy Unrestricted` in PowerShell as an administrator.
|
|
|
|
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.
|
|
|
|
```bash
|
|
function Traefik-Helper {
|
|
$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
|
|
$argsAsString = $args -join ' '
|
|
|
|
# Construct the command
|
|
$command = "python $helperPath\app.py $argsAsString"
|
|
|
|
# Run the command with the environment variable
|
|
Invoke-Expression $command
|
|
}
|
|
|
|
# Set the alias
|
|
Set-Alias -Name "traefik" -Value "Traefik-Helper"
|
|
|
|
```
|
|
|
|
This will allow you to run the `traefik` command in PowerShell.
|
|
|
|
## Todo
|
|
|
|
- [ ] Use the Traefik api to list all services
|