### Start Minikube Cluster Source: https://cloudnative-pg.io/documentation/1.27/quickstart This command initiates a single-node Kubernetes cluster using Minikube, which is suitable for local development and testing. Ensure Minikube is installed prior to running this command. ```bash minikube start ``` -------------------------------- ### Add Prometheus Helm Repository and Install Kube-Prometheus Stack Source: https://cloudnative-pg.io/documentation/1.27/quickstart Adds the prometheus-community Helm chart repository and then installs or upgrades the 'kube-prometheus-stack' using a sample configuration file. This deploys Prometheus, Grafana, and Alert Manager for observability. ```bash helm repo add prometheus-community \ https://prometheus-community.github.io/helm-charts helm upgrade --install \ -f https://raw.githubusercontent.com/cloudnative-pg/cloudnative-pg/main/docs/src/samples/monitoring/kube-stack-config.yaml \ prometheus-community \ prometheus-community/kube-prometheus-stack ``` -------------------------------- ### Create Kind Kubernetes Cluster Source: https://cloudnative-pg.io/documentation/1.27/quickstart This command creates a local Kubernetes cluster named 'pg' using Kind, which runs Kubernetes nodes as Docker containers. This is an alternative to Minikube for local cluster setup. ```bash kind create cluster --name pg ``` -------------------------------- ### Verify Minikube Cluster Nodes Source: https://cloudnative-pg.io/documentation/1.27/quickstart This command checks the status and availability of nodes within the Minikube Kubernetes cluster. It confirms that the cluster has started successfully and is ready for use. ```bash kubectl get nodes ``` -------------------------------- ### Install and Use CloudNativePG kubectl Plugin Source: https://context7.com/context7/cloudnative-pg_io_1_27/llms.txt This example details the installation of the `cnpg` kubectl plugin using a curl script and provides a comprehensive list of commands for managing PostgreSQL clusters. It covers checking cluster status, promoting instances, generating diagnostic reports, connecting via psql, triggering backups, and restarting clusters. ```bash # Install plugin curl -sSfL https://github.com/cloudnative-pg/cloudnative-pg/raw/main/hack/install-cnpg-plugin.sh | \ sudo sh -s -- -b /usr/local/bin # Get detailed cluster status kubectl cnpg status cluster-example --verbose # Promote a specific instance kubectl cnpg promote cluster-example cluster-example-2 # Generate diagnostic report kubectl cnpg report cluster cluster-example -f cluster-report.zip # Connect to database with psql kubectl cnpg psql cluster-example # Trigger on-demand backup kubectl cnpg backup cluster-example # Restart cluster with rolling update kubectl cnpg restart cluster-example ``` -------------------------------- ### Apply PostgreSQL Cluster Manifest Source: https://cloudnative-pg.io/documentation/1.27/quickstart This command applies the specified YAML configuration file to the Kubernetes cluster, instructing it to create or update the PostgreSQL cluster resource as defined in the file. ```bash kubectl apply -f cluster-example.yaml ``` -------------------------------- ### Check PostgreSQL Cluster Pods Source: https://cloudnative-pg.io/documentation/1.27/quickstart This command lists all pods in the current Kubernetes namespace, allowing you to monitor the status of the PostgreSQL cluster instances being created by CloudNativePG. ```bash kubectl get pods ``` -------------------------------- ### Get Help for Publication Create Command (kubectl) Source: https://cloudnative-pg.io/documentation/1.27/kubectl-plugin Displays the help message for the 'kubectl cnpg publication create' command, providing detailed information on its options and usage. ```bash kubectl cnpg publication create --help ``` -------------------------------- ### Get Help for 'cluster logs' Command Source: https://cloudnative-pg.io/documentation/1.27/kubectl-plugin Displays instructions and help for the 'cluster logs' sub-command. This is useful for understanding available flags and their usage. ```bash kubectl cnpg logs cluster -h ``` -------------------------------- ### Launch psql on CloudNativePG Cluster Source: https://cloudnative-pg.io/documentation/1.27/kubectl-plugin Command to start an interactive `psql` session connected to a CloudNativePG cluster. By default, connects to the primary instance as the `postgres` user. Can connect to a replica using the `--replica` option. ```bash kubectl cnpg psql CLUSTER ``` ```bash $ kubectl cnpg psql cluster-example psql (17.5 (Debian 17.5-1.pgdg110+1)) Type "help" for help. postgres=# ``` ```bash $ kubectl cnpg psql --replica cluster-example psql (17.5 (Debian 17.5-1.pgdg110+1)) Type "help" for help. postgres=# select pg_is_in_recovery(); pg_is_in_recovery ------------------- t (1 row) postgres=# \q ``` -------------------------------- ### Deploy CloudNativePG Cluster with Monitoring Enabled Source: https://cloudnative-pg.io/documentation/1.27/quickstart Applies a Kubernetes manifest to deploy a CloudNativePG cluster. This specific configuration enables monitoring by setting 'enablePodMonitor' to true, allowing Prometheus to scrape metrics from the cluster's pods. ```yaml --- apiVersion: postgresql.cnpg.io/v1 kind: Cluster metadata: name: cluster-with-metrics spec: instances: 3 storage: size: 1Gi monitoring: enablePodMonitor: true ``` -------------------------------- ### Deploy PostgreSQL Cluster Definition Source: https://cloudnative-pg.io/documentation/1.27/quickstart This command applies a YAML manifest file to create a PostgreSQL cluster in Kubernetes. The manifest defines the cluster's desired state, including the number of instances and storage size. ```yaml apiVersion: postgresql.cnpg.io/v1 kind: Cluster metadata: name: cluster-example spec: instances: 3 storage: size: 1Gi ``` -------------------------------- ### Port-Forward Prometheus Service for Local Access Source: https://cloudnative-pg.io/documentation/1.27/quickstart Establishes a port forwarding connection from the local machine to the Prometheus service within the Kubernetes cluster. This allows access to the Prometheus console via a local URL. ```bash kubectl port-forward svc/prometheus-community-kube-prometheus 9090 ``` -------------------------------- ### Example JSON-lines Log Output Source: https://cloudnative-pg.io/documentation/1.27/kubectl-plugin Demonstrates the default JSON-lines format of the logs emitted by the 'cluster logs' command. Each line is a valid JSON object containing log details. ```json {"level":"info","ts":"2023-06-30T13:37:33Z","logger":"postgres","msg":"2023-06-30 13:37:33.142 UTC [26] LOG: ending log output to stderr","source":"/controller/log/postgres","logging_pod":"cluster-example-3"} {"level":"info","ts":"2023-06-30T13:37:33Z","logger":"postgres","msg":"2023-06-30 13:37:33.142 UTC [26] HINT: Future log output will go to log destination \"csvlog\".","source":"/controller/log/postgres","logging_pod":"cluster-example-3"} … ``` -------------------------------- ### Apply Prometheus Rule for CloudNativePG Alerts Source: https://cloudnative-pg.io/documentation/1.27/quickstart Applies a PrometheusRule custom resource to the Kubernetes cluster. This rule defines alert conditions for CloudNativePG, enabling proactive monitoring and notification of potential issues. ```bash kubectl apply -f \ https://raw.githubusercontent.com/cloudnative-pg/cloudnative-pg/main/docs/src/samples/monitoring/prometheusrule.yaml ``` -------------------------------- ### Install CloudNativePG Kubectl Plugin via Script Source: https://cloudnative-pg.io/documentation/1.27/kubectl-plugin Installs the CloudNativePG kubectl plugin using a curl script. This method downloads and executes an installation script, typically placing the plugin in '/usr/local/bin'. Ensure you have sudo privileges for installation. ```bash curl -sSfL \ https://github.com/cloudnative-pg/cloudnative-pg/raw/main/hack/install-cnpg-plugin.sh | \ sudo sh -s -- -b /usr/local/bin ``` -------------------------------- ### Kubernetes ConfigMap for PostgreSQL Post-Init SQL Source: https://cloudnative-pg.io/documentation/1.27/samples/cluster-example-initdb-sql-refs Defines a Kubernetes ConfigMap containing SQL statements to be executed after PostgreSQL initialization. This is useful for setting up initial tables or data. ```yaml apiVersion: v1 kind: ConfigMap metadata: name: post-init-sql-configmap data: configmap.sql: | create table configmaps (i integer); insert into configmaps (select generate_series(1,10000)); ``` -------------------------------- ### CloudNativePG Cluster Initialization with Post-Init SQL Source: https://cloudnative-pg.io/documentation/1.27/samples/cluster-example-initdb-sql-refs Configures a CloudNativePG PostgreSQL cluster with various post-initialization SQL execution options. It includes direct SQL, SQL from ConfigMaps and Secrets, and extensions. ```yaml apiVersion: postgresql.cnpg.io/v1 kind: Cluster metadata: name: cluster-example-initdb spec: instances: 3 bootstrap: initdb: database: appdb owner: appuser postInitSQL: - create table numbers (i integer) - insert into numbers (select generate_series(1,10000)) postInitTemplateSQL: - create extension intarray postInitApplicationSQL: - create table application_numbers (i integer) - insert into application_numbers (select generate_series(1,10000)) postInitApplicationSQLRefs: configMapRefs: - name: post-init-sql-configmap key: configmap.sql secretRefs: - name: post-init-sql-secret key: secret.sql storage: size: 1Gi ``` -------------------------------- ### Get Deployments in cnpg-system Namespace (Bash) Source: https://cloudnative-pg.io/documentation/1.27/installation_upgrade Retrieves a list of deployments within the `cnpg-system` namespace. This command is used to inspect the operator's deployment status and details, showing readiness and age. ```bash $ kubectl get deployments -n cnpg-system NAME READY UP-TO-DATE AVAILABLE AGE 1/1 1 1 18m ``` -------------------------------- ### Install/Update CloudNativePG Kubectl Plugin using Krew Source: https://cloudnative-pg.io/documentation/1.27/kubectl-plugin Manages the CloudNativePG kubectl plugin installation and updates using Krew, the Kubernetes plugin manager. If Krew is installed, you can install, update, or upgrade the plugin with simple commands. ```bash kubectl krew install cnpg ``` ```bash kubectl krew update kubectl krew upgrade cnpg ``` -------------------------------- ### Install Latest Development Snapshot (Bash) Source: https://cloudnative-pg.io/documentation/1.27/installation_upgrade Installs the latest development snapshot of the CloudNativePG operator by downloading the manifest from the `cloudnative-pg/artifacts` repository. This is useful for testing pre-release versions. ```bash curl -sSfL \ https://raw.githubusercontent.com/cloudnative-pg/artifacts/main/manifests/operator-manifest.yaml | \ kubectl apply --server-side -f - ``` -------------------------------- ### Example Prometheus Metrics Output (Text) Source: https://cloudnative-pg.io/documentation/1.27/monitoring Provides an example of the actual output from the Prometheus exporter endpoint for predefined replication-related metrics. Each metric includes HELP and TYPE lines, followed by the metric name and its current value. This demonstrates the format and content. ```text # HELP cnpg_pg_replication_in_recovery Whether the instance is in recovery # TYPE cnpg_pg_replication_in_recovery gauge cnpg_pg_replication_in_recovery 0 # HELP cnpg_pg_replication_lag Replication lag behind primary in seconds # TYPE cnpg_pg_replication_lag gauge cnpg_pg_replication_lag 0 # HELP cnpg_pg_replication_streaming_replicas Number of streaming replicas connected to the instance # TYPE cnpg_pg_replication_streaming_replicas gauge cnpg_pg_replication_streaming_replicas 2 # HELP cnpg_pg_replication_is_wal_receiver_up Whether the instance wal_receiver is up # TYPE cnpg_pg_replication_is_wal_receiver_up gauge cnpg_pg_replication_is_wal_receiver_up 0 ``` -------------------------------- ### Generate Installation Manifests with kubectl cnpg Source: https://cloudnative-pg.io/documentation/1.27/kubectl-plugin This demonstrates how to use the 'cnpg install generate' command to create YAML manifests for operator installation. It allows customization of parameters such as installation namespace, replica count, and watched namespaces. The output can be redirected to a file (e.g., operator.yaml). ```bash kubectl cnpg install generate --help ``` ```bash kubectl cnpg install generate \ -n king \ --version 1.23 \ --replicas 3 \ --watch-namespace "albert, bb, freddie" \ > operator.yaml ``` -------------------------------- ### Install CloudNativePG Kubectl Plugin from AUR Source: https://cloudnative-pg.io/documentation/1.27/kubectl-plugin Installs the CloudNativePG kubectl plugin from the Arch User Repository (AUR). This can be done by cloning the repository and using makepkg, or by using an AUR helper like paru. ```bash git clone https://aur.archlinux.org/kubectl-cnpg.git cd kubectl-cnpg makepkg -si ``` ```bash paru -S kubectl-cnpg ``` -------------------------------- ### Define CloudNativePG PostgreSQL Cluster Resource Source: https://cloudnative-pg.io/documentation/1.27/samples/cluster-example-logical-destination This YAML defines a CloudNativePG Cluster resource. It specifies the number of instances, storage size, and bootstrap configuration, including importing schema from an external cluster. Dependencies include the CloudNativePG operator being installed in the Kubernetes cluster. ```yaml apiVersion: postgresql.cnpg.io/v1 kind: Cluster metadata: name: cluster-example-dest spec: instances: 1 storage: size: 1Gi bootstrap: initdb: import: type: microservice schemaOnly: true databases: - app source: externalCluster: cluster-example externalClusters: - name: cluster-example connectionParameters: host: cluster-example-rw.default.svc user: app dbname: app password: name: cluster-example-app key: password ``` -------------------------------- ### Filter Pods by Cluster Label Source: https://cloudnative-pg.io/documentation/1.27/quickstart This command retrieves pods associated with a specific PostgreSQL cluster using a label selector. It's useful for isolating cluster-related resources, especially in multi-tenant environments. ```bash kubectl get pods -l cnpg.io/cluster= ``` -------------------------------- ### Benchmark CloudNativePG Cluster with pgbench Source: https://cloudnative-pg.io/documentation/1.27/kubectl-plugin Command to benchmark an existing PostgreSQL cluster managed by CloudNativePG using `pgbench`. Requires specifying the cluster name and benchmark parameters. ```bash kubectl cnpg pgbench CLUSTER -- --time 30 --client 1 --jobs 1 ``` -------------------------------- ### Install Latest Release-Specific Snapshot (Bash) Source: https://cloudnative-pg.io/documentation/1.27/installation_upgrade Installs the latest development snapshot of the CloudNativePG operator for a specific minor release (e.g., release-1.27) by downloading the manifest from the `cloudnative-pg/artifacts` repository. ```bash curl -sSfL \ https://raw.githubusercontent.com/cloudnative-pg/artifacts/release-1.27/manifests/operator-manifest.yaml | \ kubectl apply --server-side -f - ``` -------------------------------- ### Custom Startup Probe Parameters Source: https://cloudnative-pg.io/documentation/1.27/instance_manager Example of explicitly defining custom parameters for the startup probe within the `.spec.probes.startup` section. This overrides the default behavior and bypasses the automatic calculation of `failureThreshold` based on `startDelay`. ```yaml # ... snip spec: probes: startup: periodSeconds: 3 timeoutSeconds: 3 failureThreshold: 10 ``` -------------------------------- ### Install CloudNativePG Kubectl Plugin via RPM Package Source: https://cloudnative-pg.io/documentation/1.27/kubectl-plugin Installs the CloudNativePG kubectl plugin on RPM-based systems (like Red Hat/CentOS) from a downloaded .rpm package. This involves downloading the package using curl and then installing it with yum. Requires superuser privileges. ```bash curl -L https://github.com/cloudnative-pg/cloudnative-pg/releases/download/v1.27.0/kubectl-cnpg_1.27.0_linux_x86_64.rpm \ --output kube-plugin.rpm sudo yum --disablerepo=* localinstall kube-plugin.rpm ``` -------------------------------- ### Benchmark CloudNativePG Storage with fio Source: https://cloudnative-pg.io/documentation/1.27/kubectl-plugin Command to benchmark storage associated with a CloudNativePG cluster using `fio`. This requires specifying the FIO job name and optionally the namespace. ```bash kubectl cnpg fio FIO_JOB_NAME [-n NAMESPACE] ``` -------------------------------- ### Install CloudNativePG Kubectl Plugin via Debian Package Source: https://cloudnative-pg.io/documentation/1.27/kubectl-plugin Installs the CloudNativePG kubectl plugin on Debian-based systems from a downloaded .deb package. This involves downloading the package using wget and then installing it with dpkg. Requires superuser privileges. ```bash wget https://github.com/cloudnative-pg/cloudnative-pg/releases/download/v1.27.0/kubectl-cnpg_1.27.0_linux_x86_64.deb \ --output-document kube-plugin.deb sudo dpkg -i kube-plugin.deb ``` -------------------------------- ### CloudNativePG Cluster Definition with Managed Roles (YAML) Source: https://cloudnative-pg.io/documentation/1.27/samples/cluster-example-with-roles Defines a CloudNativePG cluster configuration with three instances and specifies managed roles. It includes examples of creating roles like 'app' and 'dante', setting their permissions (createdb, login, superuser), defining role inheritance, and linking user credentials to Kubernetes Secrets. ```yaml apiVersion: postgresql.cnpg.io/v1 kind: Cluster metadata: name: cluster-example-with-roles spec: instances: 3 storage: size: 1Gi managed: roles: - name: app createdb: true login: true - name: dante ensure: present comment: my database-side comment login: true superuser: false createdb: true createrole: false inherit: false replication: false bypassrls: false connectionLimit: 4 validUntil: "2053-04-12T15:04:05Z" inRoles: - pg_monitor - pg_signal_backend passwordSecret: name: cluster-example-dante --- ``` -------------------------------- ### Get fio Deployment Status Source: https://cloudnative-pg.io/documentation/1.27/benchmarking This command retrieves the status of the fio deployment created by the 'fio' command. It shows the readiness and availability of the deployment's pods. ```bash kubectl get deployment/fio-job -n fio ``` -------------------------------- ### CloudNativePG Cluster Configuration: Remote Synchronous Replicas Source: https://cloudnative-pg.io/documentation/1.27/failover This configuration example demonstrates how to set up a CloudNativePG cluster with remote synchronous replicas. It specifies the total number of instances, the synchronous replication method and number, and lists pre-defined standby names. This setup impacts failover capabilities as remote replicas contribute to N but not R. ```yaml instances: 3 postgresql: synchronous: method: any number: 2 standbyNamesPre: - angus ``` ```yaml instances: 3 postgresql: synchronous: method: any number: 1 maxStandbyNamesFromCluster: 1 standbyNamesPre: - angus ``` ```yaml instances: 3 postgresql: synchronous: method: any number: 1 maxStandbyNamesFromCluster: 0 standbyNamesPre: - angus - malcolm ``` -------------------------------- ### Specify PostgreSQL Image Version Source: https://cloudnative-pg.io/documentation/1.27/quickstart This YAML snippet demonstrates how to override the default PostgreSQL image used by CloudNativePG. By specifying `imageName`, you can enforce the use of a particular PostgreSQL version (e.g., 13.6) for the cluster. ```yaml apiVersion: postgresql.cnpg.io/v1 kind: Cluster metadata: # [...] spec: # [...] imageName: ghcr.io/cloudnative-pg/postgresql:13.6 #[...] ``` -------------------------------- ### Describe Operator Deployment (Bash) Source: https://cloudnative-pg.io/documentation/1.27/installation_upgrade Provides detailed information about a specific CloudNativePG operator deployment within the `cnpg-system` namespace. This command is useful for troubleshooting and understanding the deployment configuration. ```bash kubectl describe deploy \ -n cnpg-system \ ``` -------------------------------- ### Default Startup Probe Configuration Source: https://cloudnative-pg.io/documentation/1.27/instance_manager Default parameters for the Kubernetes startup probe used by CloudNativePG for PostgreSQL instances. These settings control how the probe checks if a PostgreSQL instance has successfully started. The `failureThreshold` is dynamically calculated based on `startDelay` and `periodSeconds`. ```yaml failureThreshold: FAILURE_THRESHOLD periodSeconds: 10 successThreshold: 1 timeoutSeconds: 5 ``` -------------------------------- ### Install CloudNativePG Operator Manifest (Bash) Source: https://cloudnative-pg.io/documentation/1.27/installation_upgrade Installs the latest CloudNativePG operator manifest for a specific minor release (e.g., 1.27.0) using `kubectl apply`. This method is suitable for direct installation via a YAML manifest. ```bash kubectl apply --server-side -f \ https://raw.githubusercontent.com/cloudnative-pg/cloudnative-pg/release-1.27/releases/cnpg-1.27.0.yaml ``` -------------------------------- ### Configure Auto-completion for CloudNativePG Kubectl Plugin Source: https://cloudnative-pg.io/documentation/1.27/kubectl-plugin Sets up shell auto-completion for the CloudNativePG kubectl plugin. This involves creating a helper script, making it executable, and placing it in a directory within your system's PATH, typically requiring superuser privileges. ```bash cat > kubectl_complete-cnpg < cnpg_for_specific_namespace.yaml ``` -------------------------------- ### Kubernetes Secret for PostgreSQL Post-Init SQL Source: https://cloudnative-pg.io/documentation/1.27/samples/cluster-example-initdb-sql-refs Defines a Kubernetes Secret containing sensitive SQL statements for PostgreSQL initialization. This is suitable for SQL that might involve credentials or sensitive configurations. ```yaml apiVersion: v1 kind: Secret metadata: name: post-init-sql-secret stringData: secret.sql: | create table secrets (i integer); insert into secrets (select generate_series(1,10000)); ``` -------------------------------- ### Create PostgreSQL Publication using kubectl Source: https://cloudnative-pg.io/documentation/1.27/kubectl-plugin Creates a PostgreSQL publication on a source cluster. This command can publish all tables or a specified publication name. It is executed on the local cluster, targeting the source cluster, potentially via an external cluster configuration. ```bash kubectl cnpg publication create destination-cluster \ --external-cluster=source-cluster --all-tables ``` ```bash kubectl cnpg publication create source-cluster \ --publication=app --all-tables ``` -------------------------------- ### Install/Update CloudNativePG Kubectl Plugin using Homebrew Source: https://cloudnative-pg.io/documentation/1.27/kubectl-plugin Installs or updates the CloudNativePG kubectl plugin using Homebrew on macOS or Linux. This method relies on the community-maintained Homebrew formula for the plugin. ```bash brew install kubectl-cnpg ``` ```bash brew update brew upgrade kubectl-cnpg ``` -------------------------------- ### CloudNativePG Kubernetes Cluster Definition Source: https://cloudnative-pg.io/documentation/1.27/samples/cluster-example-full Defines a full CloudNativePG Kubernetes cluster with detailed specifications. It includes PostgreSQL parameters, bootstrap configuration, storage, backup settings using Barman with S3, resource requests/limits, and affinity rules. ```yaml apiVersion: postgresql.cnpg.io/v1 kind: Cluster metadata: name: cluster-example-full spec: description: "Example of cluster" imageName: ghcr.io/cloudnative-pg/postgresql:17.5 # imagePullSecret is only required if the images are located in a private registry # imagePullSecrets: # - name: private_registry_access instances: 3 startDelay: 300 stopDelay: 300 primaryUpdateStrategy: unsupervised postgresql: parameters: shared_buffers: 256MB pg_stat_statements.max: '10000' pg_stat_statements.track: all auto_explain.log_min_duration: '10s' pg_hba: - host all all 10.244.0.0/16 md5 bootstrap: initdb: database: app owner: app secret: name: cluster-example-app-user # Alternative bootstrap method: start from a backup #recovery: # backup: # name: backup-example enableSuperuserAccess: true superuserSecret: name: cluster-example-superuser storage: storageClass: standard size: 1Gi backup: barmanObjectStore: destinationPath: s3://cluster-example-full-backup/ endpointURL: http://custom-endpoint:1234 s3Credentials: accessKeyId: name: backup-creds key: ACCESS_KEY_ID secretAccessKey: name: backup-creds key: ACCESS_SECRET_KEY wal: compression: gzip encryption: AES256 data: compression: gzip encryption: AES256 immediateCheckpoint: false jobs: 2 retentionPolicy: "30d" resources: requests: memory: "512Mi" cpu: "1" limits: memory: "1Gi" cpu: "2" affinity: enablePodAntiAffinity: true topologyKey: failure-domain.beta.kubernetes.io/zone nodeMaintenanceWindow: inProgress: false reusePVC: false ``` -------------------------------- ### List Installed PostgreSQL Extensions Source: https://cloudnative-pg.io/documentation/1.27/postgis After connecting to the 'app' database, this command lists all installed extensions. It's used to verify that the specific PostGIS extensions declared in the Database resource are indeed installed and available for use within the database. ```sql app=# \dx List of installed extensions Name | Version | Schema | Description ------------------------+---------+------------+------------------------------------------------------------ fuzzystrmatch | 1.2 | public | determine similarities and distance between strings plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language postgis | 3.5.2 | public | PostGIS geometry and geography spatial types and functions postgis_tiger_geocoder | 3.5.2 | tiger | PostGIS tiger geocoder and reverse geocoder postgis_topology | 3.5.2 | topology | PostGIS topology spatial types and functions (5 rows) ``` -------------------------------- ### Kubernetes ConfigMap Definition Source: https://cloudnative-pg.io/documentation/1.27/samples/cluster-example-projected-volume This defines a Kubernetes ConfigMap containing key-value pairs. These values can be injected into pods as environment variables or mounted as files. In this example, `key1` and `key2` are used in the projected volume. ```yaml apiVersion: v1 data: key1: value1 key2: value2 key3: value3 kind: ConfigMap metadata: name: sample-configmap ``` -------------------------------- ### Kubernetes Role for Cluster Logs Access Source: https://cloudnative-pg.io/documentation/1.27/kubectl-plugin This Role grants permissions to 'get' cluster information and 'list' pods, as well as 'get' access to pod logs. It's useful for roles that need to inspect cluster logs. Ensure the correct API groups and resources are specified. ```yaml --- apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: name: cnpg-log rules: - verbs: - get apiGroups: - postgresql.cnpg.io resources: - clusters - verbs: - list apiGroups: - '' resources: - pods - verbs: - get apiGroups: - '' resources: - pods/log ``` -------------------------------- ### View detailed cluster status Source: https://cloudnative-pg.io/documentation/1.27/kubectl-plugin The `kubectl cnpg status` command with the `-v` flag provides additional details about PostgreSQL configuration, HBA settings, and certificates for a given cluster. ```bash kubectl cnpg status sandbox -v -v ``` -------------------------------- ### Unzip Report Archive Source: https://cloudnative-pg.io/documentation/1.27/kubectl-plugin Illustrates how to unzip the generated report archive file. The archive contains directories for manifests and optionally logs, with YAML files detailing the cluster's state. ```bash unzip report.zip ``` ```bash unzip report_cluster_.zip ``` -------------------------------- ### Get Full PostGIS Version Information Source: https://cloudnative-pg.io/documentation/1.27/postgis Executes the `postgis_full_version()` SQL function within the 'app' database to retrieve detailed information about the installed PostGIS version, including its compilation settings, dependencies like GEOS and PROJ, and other library versions. This is a comprehensive check of the PostGIS installation. ```sql app=# SELECT postgis_full_version(); postgis_full_version ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ``` -------------------------------- ### Create PostgreSQL Logical Replication Publication (kubectl) Source: https://cloudnative-pg.io/documentation/1.27/kubectl-plugin Creates a PostgreSQL logical replication publication for a specified CloudNativePG cluster. It supports creating publications for all tables or specific tables/schemas, and can target external clusters. ```bash kubectl cnpg publication create \ --publication PUBLICATION_NAME \ [--external-cluster EXTERNAL_CLUSTER] LOCAL_CLUSTER [options] ``` -------------------------------- ### Get Logs for a PostgreSQL Instance Source: https://cloudnative-pg.io/documentation/1.27/troubleshooting Fetches all logs from a specific PostgreSQL instance's pod. This is a fundamental command for debugging PostgreSQL and application behavior. ```bash kubectl logs -n - ``` -------------------------------- ### Add Extension to Database (Kubernetes YAML) Source: https://cloudnative-pg.io/documentation/1.27/imagevolume_extensions Shows how to request the installation of a pre-configured extension within a specific database of a CloudNativePG cluster using the Database resource. CloudNativePG automatically reconciles this, executing 'CREATE EXTENSION' if needed. ```yaml apiVersion: postgresql.cnpg.io/v1 kind: Database metadata: name: foo-app spec: name: app owner: app cluster: name: foo-18 extensions: - name: foo version: 1.0 ``` -------------------------------- ### PgBouncer Prometheus Metrics Example Source: https://cloudnative-pg.io/documentation/1.27/connection_pooling This snippet displays an example output of Prometheus metrics collected from a PgBouncer instance. These metrics are prefixed with 'cnpg_pgbouncer_' and include information about collection duration, errors, and the number of databases. The exporter runs on port 9127. ```text # HELP cnpg_pgbouncer_collection_duration_seconds Collection time duration in seconds # TYPE cnpg_pgbouncer_collection_duration_seconds gauge cnpg_pgbouncer_collection_duration_seconds{collector="Collect.up"} 0.002338805 # HELP cnpg_pgbouncer_collection_errors_total Total errors occurred accessing PostgreSQL for metrics. # TYPE cnpg_pgbouncer_collection_errors_total counter cnpg_pgbouncer_collection_errors_total{collector="sql: Scan error on column index 16, name \"load_balance_hosts\": converting NULL to int is unsupported"} 5 # HELP cnpg_pgbouncer_collections_total Total number of times PostgreSQL was accessed for metrics. # TYPE cnpg_pgbouncer_collections_total counter cnpg_pgbouncer_collections_total 5 # HELP cnpg_pgbouncer_last_collection_error 1 if the last collection ended with error, 0 otherwise. # TYPE cnpg_pgbouncer_last_collection_error gauge cnpg_pgbouncer_last_collection_error 0 # HELP cnpg_pgbouncer_lists_databases Count of databases. # TYPE cnpg_pgbouncer_lists_databases gauge cnpg_pgbouncer_lists_databases 1 # HELP cnpg_pgbouncer_lists_dns_names Count of DNS names in the cache. ``` -------------------------------- ### Follow Cluster Pod Logs with Tail Option Source: https://cloudnative-pg.io/documentation/1.27/kubectl-plugin Combines the '-f' flag to follow logs in real-time with the '--tail' option to specify the number of historical log lines to retrieve from each pod. Logs are streamed until the current time, and then new logs are followed. ```bash kubectl cnpg logs cluster CLUSTER -f --tail 3 ``` -------------------------------- ### CNPG-I Standalone Plugin Service Example (YAML) Source: https://cloudnative-pg.io/documentation/1.27/cnpg_i This YAML defines a Kubernetes Service for a standalone CNPG-I plugin. It includes essential annotations and labels required by CloudNativePG for plugin discovery, specifying the gRPC port and a unique plugin name. ```yaml apiVersion: v1 kind: Service metadata: annotations: cnpg.io/pluginPort: "9090" labels: cnpg.io/pluginName: cnpg-i-plugin-example.my-org.io name: cnpg-i-plugin-example spec: ports: - port: 9090 protocol: TCP targetPort: 9090 selector: app: cnpg-i-plugin-example ``` -------------------------------- ### Get Operator Pods List - Bash Source: https://cloudnative-pg.io/documentation/1.27/troubleshooting Retrieves a list of pods running the CloudNativePG operator in the `cnpg-system` namespace. This is useful for identifying operator instances, especially in high availability setups. ```bash kubectl get pods -n cnpg-system ``` -------------------------------- ### CloudNativePG Cluster Manifest with Resource Allocation Source: https://cloudnative-pg.io/documentation/1.27/resource_management This example shows a complete CloudNativePG `Cluster` manifest, specifying the number of instances, PostgreSQL parameters like `shared_buffers`, and detailed resource `requests` and `limits` for memory and CPU. It also includes storage configuration. ```yaml apiVersion: postgresql.cnpg.io/v1 kind: Cluster metadata: name: postgresql-resources spec: instances: 3 postgresql: parameters: shared_buffers: "256MB" resources: requests: memory: "1024Mi" cpu: 1 limits: memory: "1024Mi" cpu: 1 storage: size: 1Gi ``` -------------------------------- ### Promote a PostgreSQL instance to primary Source: https://cloudnative-pg.io/documentation/1.27/kubectl-plugin The `kubectl cnpg promote` command allows promoting a specific PostgreSQL instance within a cluster to become the primary. This is useful for maintenance or testing switch-over scenarios. It can target a cluster instance by name or by instance node number. ```bash kubectl cnpg promote CLUSTER CLUSTER-INSTANCE ``` ```bash kubectl cnpg promote CLUSTER INSTANCE ``` -------------------------------- ### Verify Operator Deployment Rollout Status (Bash) Source: https://cloudnative-pg.io/documentation/1.27/installation_upgrade Verifies the rollout status of the CloudNativePG operator's deployment in the `cnpg-system` namespace. This command helps confirm that the operator deployment has successfully completed. ```bash kubectl rollout status deployment \ -n cnpg-system cnpg-controller-manager ``` -------------------------------- ### Report Cluster with Logs Enabled Source: https://cloudnative-pg.io/documentation/1.27/kubectl-plugin Shows how to use the 'kubectl cnpg report cluster' command with the '--logs' flag to include pod and job logs in the generated report. This provides more detailed information for troubleshooting. ```bash kubectl cnpg report cluster CLUSTER [-n NAMESPACE] --logs ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.