Skip to content

Instantly share code, notes, and snippets.

@theprantadutta
Last active September 17, 2024 09:25
Show Gist options
  • Save theprantadutta/1d6728788a7670050767a720ad053f68 to your computer and use it in GitHub Desktop.
Save theprantadutta/1d6728788a7670050767a720ad053f68 to your computer and use it in GitHub Desktop.
Installs Kube VIP in system, run ``` curl -O https://gist.githubusercontent.com/theprantadutta/1d6728788a7670050767a720ad053f68/raw/generate-vip.sh && chmod +x generate-vip.sh && ./generate-vip.sh```
#!/bin/bash
# Ask for VIP and Interface
read -p "Enter the Virtual IP (VIP): " VIP
read -p "Enter the network interface: " INTERFACE
# Fetch Kube-vip version
KVVERSION=$(curl -sL https://api.github.com/repos/kube-vip/kube-vip/releases | jq -r ".[0].name")
if [ -z "$KVVERSION" ]; then
echo "Failed to fetch Kube-vip version"
exit 1
fi
echo "Kube-vip version: $KVVERSION"
# Pull Kube-vip image
if ! ctr image pull ghcr.io/kube-vip/kube-vip:$KVVERSION; then
echo "Failed to pull Kube-vip image"
exit 1
fi
# Run Kube-vip to generate the manifest
if ! ctr run --rm --net-host ghcr.io/kube-vip/kube-vip:$KVVERSION vip /kube-vip manifest pod \
--interface $INTERFACE \
--address $VIP \
--controlplane \
--services \
--arp \
--leaderElection | sudo tee /etc/kubernetes/manifests/kube-vip.yaml; then
echo "Failed to generate Kube-vip manifest"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment