Tuesday, April 28, 2020

use helm to install postgres

d:\tmp>helm install postgres --set image.repository=postgres --set image.tag=10.
6 --set postgresqlDataDir=/data/pgdata --set persistence.mountPath=/data/ stable
/postgresql
WARNING: This chart is deprecated
NAME: postgres
LAST DEPLOYED: Wed Apr 29 10:16:52 2020
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
This Helm chart is deprecated

Given the `stable` deprecation timeline (https://github.com/helm/charts#deprecat
ion-timeline), the Bitnami maintained Helm chart is now located at bitnami/chart
s (https://github.com/bitnami/charts/).

The Bitnami repository is already included in the Hubs and we will continue prov
iding the same cadence of updates, support, etc that we've been keeping here the
se years. Installation instructions are very similar, just adding the _bitnami_
repo and using it during the installation (`bitnami/` instead of `stable/
`)

```bash
$ helm repo add bitnami https://charts.bitnami.com/bitnami
$ helm install my-release bitnami/ # Helm 3
$ helm install --name my-release bitnami/ # Helm 2
```

To update an exisiting _stable_ deployment with a chart hosted in the bitnami re
pository you can execute

```bash
$ helm repo add bitnami https://charts.bitnami.com/bitnami
$ helm upgrade my-release bitnami/
```

Issues and PRs related to the chart itself will be redirected to `bitnami/charts
` GitHub repository. In the same way, we'll be happy to answer questions related
to this migration process in this issue (https://github.com/helm/charts/issues/
20969) created as a common place for discussion.

** Please be patient while the chart is being deployed **

PostgreSQL can be accessed via port 5432 on the following DNS name from within y
our cluster:

postgres-postgresql.default.svc.cluster.local - Read/Write connection

To get the password for "postgres" run:

export POSTGRES_PASSWORD=$(kubectl get secret --namespace default postgres-p
ostgresql -o jsonpath="{.data.postgresql-password}" | base64 --decode)

To connect to your database run the following command:

kubectl run postgres-postgresql-client --rm --tty -i --restart='Never' --nam
espace default --image docker.io/postgres:10.6 --env="PGPASSWORD=$POSTGRES_PASSW
ORD" --command -- psql --host postgres-postgresql -U postgres -d postgres -p 543
2



To connect to your database from outside the cluster execute the following comma
nds:

kubectl port-forward --namespace default svc/postgres-postgresql 5432:5432 &
PGPASSWORD="$POSTGRES_PASSWORD" psql --host 127.0.0.1 -U postgres -d postgre
s -p 5432

d:\tmp>kubectl get ns
NAME STATUS AGE
default Active 22h
docker Active 22h
kube-node-lease Active 22h
kube-public Active 22h
kube-system Active 22h

d:\tmp>kubectl get pods
NAME READY STATUS RESTARTS AGE
postgres-postgresql-0 1/1 Running 0 6m43s

To see mode detail :

d:\tmp>kubectl describe pods postgres-postgresql-0
Name: postgres-postgresql-0
Namespace: default
Priority: 0
...




No comments: