Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 46 additions & 19 deletions product_docs/docs/postgres_for_kubernetes/1/kubectl-plugin.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,11 @@ wget https://github.com/EnterpriseDB/kubectl-cnp/releases/download/v1.30.0/kubec

Then, with superuser privileges, install from the local file using `dpkg`:

```console
$ sudo dpkg -i kube-plugin.deb
```sh
sudo dpkg -i kube-plugin.deb
```

```output
Selecting previously unselected package cnp.
(Reading database ... 6688 files and directories currently installed.)
Preparing to unpack kube-plugin.deb ...
Expand All @@ -67,8 +70,11 @@ curl -L https://github.com/EnterpriseDB/kubectl-cnp/releases/download/v1.30.0/ku

Then, with superuser privileges, install with `yum`, and you're ready to use:

```console
$ sudo yum --disablerepo=* localinstall kube-plugin.rpm
```sh
sudo yum --disablerepo=* localinstall kube-plugin.rpm
```

```output
Failed to set locale, defaulting to C.UTF-8
Dependencies resolved.
====================================================================================================
Expand Down Expand Up @@ -796,9 +802,11 @@ kubectl cnp report cluster cluster-example -f --tail 3

With the `-o` option omitted, and with `--output` specified:

```console
$ kubectl cnp logs cluster cluster-example --output my-cluster.log
```sh
kubectl cnp logs cluster cluster-example --output my-cluster.log
```

```output
Successfully written logs to "my-cluster.log"
```

Expand All @@ -810,8 +818,11 @@ into a human-readable output, and attempts to sort the entries by timestamp.
It can be used in combination with `kubectl cnp logs cluster`, as
shown in the following example:

```console
$ kubectl cnp logs cluster cluster-example | kubectl cnp logs pretty
```sh
kubectl cnp logs cluster cluster-example | kubectl cnp logs pretty
```

```output
2024-10-15T17:35:00.336 INFO cluster-example-1 instance-manager Starting {{name.ln}} Instance Manager
2024-10-15T17:35:00.336 INFO cluster-example-1 instance-manager Checking for free disk space for WALs before starting PostgreSQL
2024-10-15T17:35:00.347 INFO cluster-example-1 instance-manager starting tablespace manager
Expand All @@ -823,8 +834,11 @@ Alternatively, it can be used in combination with other commands that produce
{{name.abbr}} logs in JSON format, such as `stern`, or `kubectl logs`, as in the
following example:

```console
$ kubectl logs cluster-example-1 | kubectl cnp logs pretty
```sh
kubectl logs cluster-example-1 | kubectl cnp logs pretty
```

```output
2024-10-15T17:35:00.336 INFO cluster-example-1 instance-manager Starting {{name.ln}} Instance Manager
2024-10-15T17:35:00.336 INFO cluster-example-1 instance-manager Checking for free disk space for WALs before starting PostgreSQL
2024-10-15T17:35:00.347 INFO cluster-example-1 instance-manager starting tablespace manager
Expand All @@ -837,8 +851,11 @@ to display logs for specific pods or loggers, or to filter logs by severity
level.
Here's an example:

```console
$ kubectl cnp logs cluster cluster-example | kubectl cnp logs pretty --pods cluster-example-1 --loggers postgres --log-level info
```sh
kubectl cnp logs cluster cluster-example | kubectl cnp logs pretty --pods cluster-example-1 --loggers postgres --log-level info
```

```output
2024-10-15T17:35:00.509 INFO cluster-example-1 postgres 2024-10-15 17:35:00.509 UTC [29] LOG: redirecting log output to logging collector process
2024-10-15T17:35:00.509 INFO cluster-example-1 postgres 2024-10-15 17:35:00.509 UTC [29] HINT: Future log output will appear in directory "/controller/log"...
2024-10-15T17:35:00.510 INFO cluster-example-1 postgres 2024-10-15 17:35:00.509 UTC [29] LOG: ending log output to stderr
Expand All @@ -854,8 +871,11 @@ mode. The sub-command will add a group separator line, `---`, at the end of
each sorted group. The size of the grouping can be configured via the
`--sorting-group-size` flag (default: 1000), as illustrated in the following example:

```console
$ kubectl cnp logs cluster cluster-example | kubectl cnp logs pretty --sorting-group-size=3
```sh
kubectl cnp logs cluster cluster-example | kubectl cnp logs pretty --sorting-group-size=3
```

```output
2024-10-15T17:35:20.426 INFO cluster-example-2 instance-manager Starting {{name.ln}} Instance Manager
2024-10-15T17:35:20.426 INFO cluster-example-2 instance-manager Checking for free disk space for WALs before starting PostgreSQL
2024-10-15T17:35:20.438 INFO cluster-example-2 instance-manager starting tablespace manager
Expand Down Expand Up @@ -1005,7 +1025,10 @@ kubectl cnp backup [cluster_name] -m volumeSnapshot
The created backup will be named after the request time:

```console
$ kubectl cnp backup cluster-example
kubectl cnp backup cluster-example
```

```output
backup/cluster-example-20230121002300 created
```

Expand All @@ -1032,9 +1055,11 @@ As you will be connecting as `postgres` user, in production environments this
method should be used with extreme care, by authorized personnel only.
!!!

```console
$ kubectl cnp psql cluster-example
```sh
kubectl cnp psql cluster-example
```

```output
psql (17.0 (Debian 17.0-1.pgdg110+1))
Type "help" for help.

Expand All @@ -1044,9 +1069,11 @@ postgres=#
By default, the command will connect to the primary instance. The user can
select to work against a replica by using the `--replica` option:

```console
$ kubectl cnp psql --replica cluster-example
```sh
kubectl cnp psql --replica cluster-example
```

```output
psql (17.0 (Debian 17.0-1.pgdg110+1))

Type "help" for help.
Expand Down
Loading