This example demonstrates deploying a performant and highly available PostgreSQL database to a Zarf airgap cluster. It uses Zalando's postgres-operator and provides the Postgres Operator UI and a deployment of PGAdmin for demo purposes.
After looking at several alternatives, Zalando's postgres operator felt like the best choice. Other tools that were close runners-up were the postgres-operator by CrunchyData and KubeDB.
-
Install Docker. Other container engines will likely work as well but aren't actively tested by the Zarf team.
-
Install KinD. Other Kubernetes distros will work as well, but we'll be using KinD for this example since it is easy and tested frequently and thoroughly.
-
Clone the Zarf project — for the example configuration files.
-
Download a Zarf release — you need a binary and an init package, here.
-
Log
zarf
into Iron Bank if you haven't already — instructions here. Optional for this specific example since the container comes from GitHub rather than Iron Bank but a good practice and needed for most of the other examples. -
(Optional) Put
zarf
on your path — technically optional but makes running commands simpler. Make sure you are picking the right binary that matches your system architecture.zarf
for x86 Linux,zarf-mac-intel
for x86 MacOS,zarf-mac-apple
for M1 MacOS. -
Create a Zarf cluster as described in the Doom example docs
# Open the directory
cd examples/postgres-operator
# Build the package
zarf package create
# Deploy the package (Press TAB for the listing of available packages)
zarf package deploy
Wait a couple of minutes. You'll know it is done when Zarf exits and you get the 3 connect commands.
- Run
zarf connect minio
to navigate to the web console. - Log in - Username:
minio
- Password:minio123
- Buckets -> Create Bucket
- Bucket Name:
postgres-operator-backups
- Bucket Name:
The Postgres Operator UI will be available by running ./zarf connect postgres-operator-ui
and pgadmin will be available by running ./zarf connect pgadmin
If you want to run other commands after/during the browsing of the postgres tools, you can add a
&
character at the end of the connect command to run the command in the background ie)./zarf connect pgadmin &
.
- General // Name:
acid-zarf-test
- General // Server group:
Servers
- Connection // Host: (the URL in the table below)
- Connection // Port:
5432
- Connection // Maintenance database:
postgres
- Connection // Username:
zarf
- Connection // Password: (run the command in the table below)
- SSL // SSL mode:
Require
kind delete cluster
Service | URL | Username | Password |
---|---|---|---|
Postgres Operator UI | zarf connect postgres-operator-ui |
N/A | N/A |
PGAdmin | zarf connect pgadmin |
[email protected] |
Run: zarf tools get-admin-password |
Example Postgres Database | acid-zarf-test.postgres-operator.svc.cluster.local |
zarf |
Run: echo $(kubectl get secret zarf.acid-zarf-test.credentials.postgresql.acid.zalan.do -n postgres-operator --template={{.data.password}} | base64 -d) |
Minio Console | zarf connect minio |
minio |
minio123 |