Setup a postgres ha-cluster with patroni on a local multi-node kubernetes cluster on windows.
Setup a PostgreSQL-HA-Cluster with Patroni on a local multi-node kubernetes cluster on windows and linux mint.
curl.exe -Lo kind-windows-amd64.exe https://github.com/kubernetes-sigs/kind/releases/download/v0.7.0/kind-windows-amd64
Move-Item .\kind-windows-amd64.exe $pwd\kind.exe
mkdir -p /kubernetes-local/kind
curl -Lo ./kind "https://github.com/kubernetes-sigs/kind/releases/download/v0.7.0/kind-$(uname)-amd64"
chmod +x ./kind
mv ./kind /kubernetes-local/kind
kind
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";$pwd", "User")
cp ~/kubernetes-local/kind/./kind /usr/local/bin
and add path to .zshrc
or .bashrc
kind
in powershell
or bash
kind-example-config.yaml
under c:/user/username/kindsample kind-example-config.yaml
## Three node (two workers) k8s-cluster config
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
- role: worker
- role: worker
kind create cluster --config <kind-example-config.yaml-path>
(Docker must be running!)kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-beta8/aio/deploy/recommended.yaml
kubectl proxy
kubectl -n kubernetes-dashboard describe secret $(kubectl -n kubernetes-dashboard get secret | grep admin-user | awk '{print $1}')
Name: kubernetes-dashboard-token-jdxjs
Namespace: kubernetes-dashboard
Labels: <none>
Annotations: kubernetes.io/service-account.name: kubernetes-dashboard
kubernetes.io/service-account.uid: aceae174-dd49-4193-aa6d-2947e04e2170
Type: kubernetes.io/service-account-token
Data
====
ca.crt: 1025 bytes
namespace: 20 bytes
token: eyJhbGciOiJSUzI1NiIsImtpZCI6InpRV1h1dmpYM25YdUNQeFF6N2hWUkZiQlFmdEw1RDY5M01WQlQ2aGx4dlUifQOA9U-2OMCbCzhhTAKc9kwIK3SxUZLLGU9qJ_FwAYWi3yWmlXwnhxyiDIvP-CqxHvf-trYeevd1djRnq-hWP5nFrafEsm90brt_7YsEGZH1ELGVp1CyD5cf9lw
Copy last access-token (token:
) on output to web-ui: token field
Alias for “kubectl” for windows powershell Set-Alias kc "C:\path\kubectl.exe"
kubernetes-dashboard
user to list, edit, … ressourceskubectl edit clusterroles kubernetes-dashboard
clusterrole: kubernetes-dashboard
- apiGroups:
- '*'
resources:
- '*'
verbs:
- '*'
In the patroni
folder are YAML-Manifest and a script for the automated deployment of on PostgreSQL-HA-Cluster with patroni.
chmod +x setup-patroni-cluster.sh
kubectl create namespace zalando-postgres
./setup-patroni-cluster.sh
kubectl get pods -n <namespace>
kubectl port-forward <pod-name> hostport:pod-port -n namespace