Helm/PgAdmin4: Difference between revisions
Jump to navigation
Jump to search
(10 intermediate revisions by the same user not shown) | |||
Line 38: | Line 38: | ||
|colspan="2"| | |colspan="2"| | ||
<syntaxhighlight lang="json"> | <syntaxhighlight lang="json"> | ||
cat <<-'JSN' | kubectl -n pgadmin create secret generic | cat <<-'JSN' | kubectl -n pgadmin create secret generic server-definitions --from-file=servers.json=/dev/stdin | ||
{ | { | ||
"Servers": { | |||
"1": { | |||
"Name": "psql.k8s.local/academia", | |||
"Group": "www.k8s.local", | |||
"Port": 5432, | |||
"Username": "academia", | |||
"MaintenanceDB": "academia", | |||
"Host": "postgresql.postgresql.svc" | |||
}, | |||
"2": { | |||
"Name": "host.k8s.local/keycloak", | |||
"Group": "host.k8s.local", | |||
"Port": 5432, | |||
"Username": "keycloak", | |||
"MaintenanceDB": "keycloak", | |||
"Host": "host.minikube.internal" | |||
}, | |||
"3": { | |||
"Name": "host.k8s.local/gitlab", | |||
"Group": "host.k8s.local", | |||
"Port": 5432, | |||
"Username": "gitlab", | |||
"MaintenanceDB": "gitlab", | |||
"Host": "host.minikube.internal" | |||
} | |||
} | |||
} | } | ||
JSN | JSN | ||
Line 163: | Line 163: | ||
fullnameOverride: pgadmin | fullnameOverride: pgadmin | ||
existingSecret: pgadmin | existingSecret: pgadmin | ||
env: | |||
email: [email protected] | |||
enhanced_cookie_protection: "True" | |||
serverDefinitions: | serverDefinitions: | ||
enabled: true | enabled: true | ||
resourceType: Secret | resourceType: Secret | ||
existingSecret: | existingSecret: server-definitions | ||
YML | YML | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 178: | Line 178: | ||
|- | |- | ||
|valign='top'| | |valign='top'| | ||
<syntaxhighlight lang=" | <syntaxhighlight lang="properties"> | ||
xdg-open http://pgadmin.k8s.local &>/dev/null & | |||
gnome-open http://pgadmin.k8s.local &>/dev/null & | |||
</syntaxhighlight> | </syntaxhighlight> | ||
|valign='top'| | |valign='top'| | ||
<syntaxhighlight lang=" | <syntaxhighlight lang="properties"> | ||
x-www-browser http://pgadmin.k8s.local &>/dev/null & | |||
sensible-browser http://pgadmin.k8s.local &>/dev/null & | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 228: | Line 226: | ||
kubectl -n pgadmin exec -it svc/pgadmin -c pgadmin4 -- ls -lah /var/lib/pgadmin/storage | kubectl -n pgadmin exec -it svc/pgadmin -c pgadmin4 -- ls -lah /var/lib/pgadmin/storage | ||
kubectl -n pgadmin exec -it svc/pgadmin -c pgadmin4 -- ls -lah /var/lib/pgadmin | kubectl -n pgadmin exec -it svc/pgadmin -c pgadmin4 -- ls -lah /var/lib/pgadmin | ||
kubectl -n pgadmin exec -it svc/pgadmin -c pgadmin4 -- cat servers.json | |||
kubectl -n pgadmin exec -it svc/pgadmin -c pgadmin4 -- python -V | kubectl -n pgadmin exec -it svc/pgadmin -c pgadmin4 -- python -V | ||
kubectl -n pgadmin exec -it svc/pgadmin -c pgadmin4 -- pip -V | kubectl -n pgadmin exec -it svc/pgadmin -c pgadmin4 -- pip -V | ||
Line 290: | Line 290: | ||
* [[Helm/GitLab External|Helm » GitLab External]] | * [[Helm/GitLab External|Helm » GitLab External]] | ||
* [[Helm/Cert Manager|Helm » Cert Manager]] | * [[Helm/Cert Manager|Helm » Cert Manager]] | ||
* [[Helm/PhpMyAdmin|Helm » PhpMyAdmin]] | |||
* [[Helm/PostgreSQL|Helm » PostgreSQL]] | * [[Helm/PostgreSQL|Helm » PostgreSQL]] | ||
* [https://artifacthub.io/packages/helm/runix/pgadmin4 Helm » PgAdmin4] | * [https://artifacthub.io/packages/helm/runix/pgadmin4 Helm » PgAdmin4] | ||
Line 328: | Line 329: | ||
| valign="top" | | | valign="top" | | ||
* [[Install pgAdmin 4 in Server Mode]] | |||
* [https://medium.com/@luis.laredo.vel/configuring-pgadmin-to-access-the-backstage-databases-in-a-kubernetes-cluster-953ee087e41d K8s » Configuring PgAdmin4] | |||
* [[PostgreSQL/PgBouncer|PostgreSQL » PgBouncer]] | |||
* [[PostgreSQL]] | * [[PostgreSQL]] | ||
|} | |} |
Latest revision as of 09:26, 17 November 2024
helm repo add runix https://helm.runix.net helm repo update && helm repo list kubectl config get-contexts
Config
export KUBECONFIG="${HOME}/.kube/dev-kubeconfig.yaml"
export KUBECONFIG="${HOME}/.kube/gcp-kubeconfig.yaml"
export KUBECONFIG="${HOME}/.kube/config"
Install
helm show values runix/pgadmin4 --version=1.30.0|less
helm show values runix/pgadmin4 --version=1.31.0|less
kubectl get ns|grep pgadmin
kubectl delete ns pgadmin
|
kubectl get ns|grep pgadmin
kubectl create ns pgadmin
cat <<ENV | kubectl -n pgadmin create secret generic pgadmin --from-env-file=/dev/stdin
password=sadaqah!
ENV
|
| |
cat <<-'JSN' | kubectl -n pgadmin create secret generic server-definitions --from-file=servers.json=/dev/stdin
{
"Servers": {
"1": {
"Name": "psql.k8s.local/academia",
"Group": "www.k8s.local",
"Port": 5432,
"Username": "academia",
"MaintenanceDB": "academia",
"Host": "postgresql.postgresql.svc"
},
"2": {
"Name": "host.k8s.local/keycloak",
"Group": "host.k8s.local",
"Port": 5432,
"Username": "keycloak",
"MaintenanceDB": "keycloak",
"Host": "host.minikube.internal"
},
"3": {
"Name": "host.k8s.local/gitlab",
"Group": "host.k8s.local",
"Port": 5432,
"Username": "gitlab",
"MaintenanceDB": "gitlab",
"Host": "host.minikube.internal"
}
}
}
JSN
| |
| |
cat << YML | kubectl -n pgadmin apply -f -
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv-pgadmin
spec:
storageClassName: standard
capacity:
storage: 10Gi
accessModes:
- ReadWriteOnce
hostPath:
path: /tmp/hostpath-provisioner/pgadmin/pvc-pgadmin
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
app.kubernetes.io/name: pgadmin
name: pvc-pgadmin
spec:
storageClassName: standard
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
volumeName: pv-pgadmin
YML
|
cat << YML | kubectl -n pgadmin apply -f -
---
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
app.kubernetes.io/name: pgadmin
name: pvc-pgadmin
spec:
storageClassName: standard
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
YML
|
| |
cat <<YML | helm -n pgadmin install pgadmin runix/pgadmin4 --version=1.31.0 -f -
---
ingress:
enabled: true
ingressClassName: nginx
hosts:
- host: pgadmin.k8s.local
paths:
- path: /
pathType: Prefix
persistentVolume:
existingClaim: pvc-pgadmin
size: 10Gi
fullnameOverride: pgadmin
existingSecret: pgadmin
env:
email: [email protected]
enhanced_cookie_protection: "True"
serverDefinitions:
enabled: true
resourceType: Secret
existingSecret: server-definitions
YML
| |
| |
xdg-open http://pgadmin.k8s.local &>/dev/null &
gnome-open http://pgadmin.k8s.local &>/dev/null &
|
x-www-browser http://pgadmin.k8s.local &>/dev/null &
sensible-browser http://pgadmin.k8s.local &>/dev/null &
|
Uninstall
helm uninstall -n pgadmin pgadmin
kubectl delete namespace pgadmin
Swiss Knife
kubectl -n postgresql run -i --tty --rm psql --image=alpine --restart=Never -- sh
echo -n password: ; read -s PGPASSWORD; export PGPASSWORD; echo
apk --update add --no-cache postgresql-client inetutils-telnet
psql -d postgres -U postgres -h postgresql.postgresql.svc.cluster.local
psql -d postgres -U postgres -h postgresql.postgresql.svc
psql -d postgres -U postgres -h postgresql.postgresql
psql -d postgres -U postgres -h postgresql
Playground
helm -n pgadmin install pgadmin runix/pgadmin4 --version=1.30.0
helm -n pgadmin upgrade -i pgadmin runix/pgadmin4 --version=1.31.0
helm show values runix/pgadmin4 --version=1.31.0|less
| |
| |
kubectl -n pgadmin exec -it svc/pgadmin -c pgadmin4 -- ls -lah /var/lib/pgadmin/storage
kubectl -n pgadmin exec -it svc/pgadmin -c pgadmin4 -- ls -lah /var/lib/pgadmin
kubectl -n pgadmin exec -it svc/pgadmin -c pgadmin4 -- cat servers.json
kubectl -n pgadmin exec -it svc/pgadmin -c pgadmin4 -- python -V
kubectl -n pgadmin exec -it svc/pgadmin -c pgadmin4 -- pip -V
kubectl -n pgadmin exec -it svc/pgadmin -c pgadmin4 -- sh
| |
| |
kubectl config --kubeconfig=${HOME}/.kube/aws-kubeconfig.yaml view --flatten
kubectl config --kubeconfig=${HOME}/.kube/dev-kubeconfig.yaml view --flatten
kubectl config --kubeconfig=${HOME}/.kube/gcp-kubeconfig.yaml view --flatten
kubectl config --kubeconfig=${HOME}/.kube/config view --flatten
| |
| |
kubectl -n pgadmin delete all --all
kubectl -n pgadmin delete ing --all
kubectl -n pgadmin delete sts --all
|
kubectl -n pgadmin delete svc --all
kubectl -n pgadmin delete pvc --all
kubectl -n pgadmin delete pv --all
|
| |
kubectl -n pgadmin rollout history deploy pgadmin
kubectl -n pgadmin rollout restart deploy pgadmin
kubectl -n pgadmin rollout status deploy pgadmin
|
kubectl -n pgadmin logs -f svc/pgadmin -c pgadmin4
kubectl -n pgadmin exec -it svc/pgadmin -- sh
kubectl -n pgadmin logs -f svc/pgadmin
|
References
| ||