-
Notifications
You must be signed in to change notification settings - Fork 40
Expand file tree
/
Copy pathindex.html
More file actions
490 lines (463 loc) · 21 KB
/
index.html
File metadata and controls
490 lines (463 loc) · 21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="author" content="The CloudNativePG Contributors" />
<link rel="shortcut icon" href="../img/favicon.ico" />
<title>Instance pod configuration - CloudNativePG v1.25</title>
<link rel="stylesheet" href="../css/theme.css" />
<link rel="stylesheet" href="../css/theme_extra.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/styles/github.min.css" />
<link href="../css/override.css" rel="stylesheet" />
<script>
// Current page data
var mkdocs_page_name = "Instance pod configuration";
var mkdocs_page_input_path = "cluster_conf.md";
var mkdocs_page_url = null;
</script>
<!--[if lt IE 9]>
<script src="../js/html5shiv.min.js"></script>
<![endif]-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/highlight.min.js"></script>
<script>hljs.highlightAll();</script>
</head>
<body class="wy-body-for-nav" role="document">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side stickynav">
<div class="wy-side-scroll">
<div class="wy-side-nav-search">
<a href=".." class="icon icon-home"> CloudNativePG v1.25
</a><div role="search">
<form id ="rtd-search-form" class="wy-form" action="../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" title="Type search term here" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<ul>
<li class="toctree-l1"><a class="reference internal" href="..">CloudNativePG</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../before_you_start/">Before You Start</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../use_cases/">Use cases</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../architecture/">Architecture</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../installation_upgrade/">Installation and upgrades</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../quickstart/">Quickstart</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../image_catalog/">Image Catalog</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../bootstrap/">Bootstrap</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../database_import/">Importing Postgres databases</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../security/">Security</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../instance_manager/">Postgres instance manager</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../scheduling/">Scheduling</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../resource_management/">Resource management</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../failure_modes/">Failure Modes</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../rolling_update/">Rolling Updates</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../replication/">Replication</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../logical_replication/">Logical Replication</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../backup/">Backup</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../backup_barmanobjectstore/">Backup on object stores</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../wal_archiving/">WAL archiving</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../backup_volumesnapshot/">Backup on volume snapshots</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../recovery/">Recovery</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../service_management/">Service Management</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../postgresql_conf/">PostgreSQL Configuration</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../declarative_role_management/">PostgreSQL Role Management</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../declarative_database_management/">PostgreSQL Database Management</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../tablespaces/">Tablespaces</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../operator_conf/">Operator configuration</a>
</li>
</ul>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal current" href="#">Instance pod configuration</a>
<ul class="current">
<li class="toctree-l2"><a class="reference internal" href="#projected-volumes">Projected volumes</a>
</li>
<li class="toctree-l2"><a class="reference internal" href="#ephemeral-volumes">Ephemeral volumes</a>
<ul>
<li class="toctree-l3"><a class="reference internal" href="#volume-claim-template-for-temporary-storage">Volume Claim Template for Temporary Storage</a>
</li>
<li class="toctree-l3"><a class="reference internal" href="#volume-for-shared-memory">Volume for shared memory</a>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#environment-variables">Environment variables</a>
</li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../storage/">Storage</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../labels_annotations/">Labels and annotations</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../monitoring/">Monitoring</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../logging/">Logging</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../certificates/">Certificates</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../ssl_connections/">Client TLS/SSL connections</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../applications/">Connecting from an application</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../connection_pooling/">Connection pooling</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../replica_cluster/">Replica clusters</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../kubernetes_upgrade/">Kubernetes Upgrade and Maintenance</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../kubectl-plugin/">Kubectl Plugin</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../failover/">Automated failover</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../troubleshooting/">Troubleshooting</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../fencing/">Fencing</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../declarative_hibernation/">Declarative hibernation</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../postgis/">PostGIS</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../e2e/">End-to-End Tests</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../container_images/">Container Image Requirements</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../operator_capability_levels/">Operator capability levels</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../controller/">Custom Pod Controller</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../samples/">Examples</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../networking/">Networking</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../benchmarking/">Benchmarking</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../faq/">Frequently Asked Questions (FAQ)</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../cloudnative-pg.v1/">API Reference</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../supported_releases/">Supported releases</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../preview_version/">Preview Versions</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../release_notes/">Release notes</a>
</li>
</ul>
<p class="caption"><span class="caption-text">CNCF Projects Integrations</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../cncf-projects/external-secrets/">External Secrets</a>
</li>
<li class="toctree-l1"><a class="reference internal" href="../cncf-projects/cilium/">Cilium</a>
</li>
</ul>
<p class="caption"><span class="caption-text">Appendixes</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../appendixes/object_stores/">Appendix A - Common object stores for backups</a>
</li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="Mobile navigation menu">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="..">CloudNativePG v1.25</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content"><div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href=".." class="icon icon-home" aria-label="Docs"></a></li>
<li class="breadcrumb-item active">Instance pod configuration</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div class="section" itemprop="articleBody">
<h1 id="instance-pod-configuration">Instance pod configuration</h1>
<!-- SPDX-License-Identifier: CC-BY-4.0 -->
<h2 id="projected-volumes">Projected volumes</h2>
<p>CloudNativePG supports mounting custom files inside the Postgres pods through
<code>.spec.projectedVolumeTemplate</code>. This ability is useful for several Postgres
features and extensions that require additional data files.
In CloudNativePG, the <code>.spec.projectedVolumeTemplate</code> field is a
<a href="https://kubernetes.io/docs/concepts/storage/projected-volumes/">projected volume</a>
template in Kubernetes that allows you to mount arbitrary data under the
<code>/projected</code> folder in Postgres pods.</p>
<p>This simple example shows how to mount an existing TLS secret (named
<code>sample-secret</code>) as files into Postgres pods. The values for the secret keys
<code>tls.crt</code> and <code>tls.key</code> in <code>sample-secret</code> are mounted as files into the paths
<code>/projected/certificate/tls.crt</code> and <code>/projected/certificate/tls.key</code> in the
Postgres pod.</p>
<pre><code class="language-yaml">apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: cluster-example-projected-volumes
spec:
instances: 3
projectedVolumeTemplate:
sources:
- secret:
name: sample-secret
items:
- key: tls.crt
path: certificate/tls.crt
- key: tls.key
path: certificate/tls.key
storage:
size: 1Gi
</code></pre>
<p>You can find a complete example that uses a projected volume template to mount
the secret and ConfigMap in the
<a href="../samples/cluster-example-projected-volume.yaml">cluster-example-projected-volume.yaml</a>
deployment manifest.</p>
<h2 id="ephemeral-volumes">Ephemeral volumes</h2>
<p>CloudNativePG relies on <a href="https://kubernetes.io/docs/concepts/storage/ephemeral-volumes/">ephemeral volumes</a>
for part of the internal activities. Ephemeral volumes exist for the sole
duration of a pod's life, without persisting across pod restarts.</p>
<h3 id="volume-claim-template-for-temporary-storage">Volume Claim Template for Temporary Storage</h3>
<p>The operator uses by default an <code>emptyDir</code> volume, which can be customized by using the <code>.spec.ephemeralVolumesSizeLimit field</code>.
This can be overridden by specifying a volume claim template in the <code>.spec.ephemeralVolumeSource</code> field.</p>
<p>In the following example, a <code>1Gi</code> ephemeral volume is set.</p>
<pre><code class="language-yaml">apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: cluster-example-ephemeral-volume-source
spec:
instances: 3
ephemeralVolumeSource:
volumeClaimTemplate:
spec:
accessModes: ["ReadWriteOnce"]
# example storageClassName, replace with one existing in your Kubernetes cluster
storageClassName: "scratch-storage-class"
resources:
requests:
storage: 1Gi
</code></pre>
<p>Both <code>.spec.emphemeralVolumeSource</code> and <code>.spec.ephemeralVolumesSizeLimit.temporaryData</code> cannot be specified simultaneously.</p>
<h3 id="volume-for-shared-memory">Volume for shared memory</h3>
<p>This volume is used as shared memory space for Postgres and as an ephemeral
type but stored in memory. You can configure an upper bound on the size using
the <code>.spec.ephemeralVolumesSizeLimit.shm</code> field in the cluster spec.
Use this field only in case of
<a href="../postgresql_conf/#dynamic-shared-memory-settings">PostgreSQL running with <code>posix</code> shared memory dynamic allocation</a>.</p>
<h2 id="environment-variables">Environment variables</h2>
<p>You can customize some system behavior using environment variables. One example
is the <code>LDAPCONF</code> variable, which can point to a custom LDAP configuration
file. Another example is the <code>TZ</code> environment variable, which represents the
timezone used by the PostgreSQL container.</p>
<p>CloudNativePG allows you to set custom environment variables using the <code>env</code>
and the <code>envFrom</code> stanza of the cluster specification.</p>
<p>This example defines a PostgreSQL cluster using the <code>Australia/Sydney</code>
timezone as the default cluster-level timezone:</p>
<pre><code class="language-yaml">apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: cluster-example
spec:
instances: 3
env:
- name: TZ
value: Australia/Sydney
storage:
size: 1Gi
</code></pre>
<p>The <code>envFrom</code> stanza can refer to ConfigMaps or secrets to use their content as
environment variables:</p>
<pre><code class="language-yaml">apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: cluster-example
spec:
instances: 3
envFrom:
- configMapRef:
name: config-map-name
- secretRef:
name: secret-name
storage:
size: 1Gi
</code></pre>
<p>The operator doesn't allow setting the following environment variables:</p>
<ul>
<li><code>POD_NAME</code></li>
<li><code>NAMESPACE</code></li>
<li>Any environment variable whose name starts with <code>PG</code>.</li>
</ul>
<p>Any change in the <code>env</code> or in the <code>envFrom</code> section triggers a rolling
update of the PostgreSQL pods.</p>
<p>If the <code>env</code> or the <code>envFrom</code> section refers to a secret or a ConfigMap, the
operator doesn't detect any changes in them and doesn't trigger a rollout. The
kubelet uses the same behavior with pods, and you must trigger the pod rollout
manually.</p>
</div>
</div><footer>
<div class="rst-footer-buttons" role="navigation" aria-label="Footer Navigation">
<a href="../operator_conf/" class="btn btn-neutral float-left" title="Operator configuration"><span class="icon icon-circle-arrow-left"></span> Previous</a>
<a href="../storage/" class="btn btn-neutral float-right" title="Storage">Next <span class="icon icon-circle-arrow-right"></span></a>
</div>
<hr/>
<div role="contentinfo">
<!-- Copyright etc -->
<p>Copyright © CloudNativePG a Series of LF Projects, LLC</p>
</div>
Built with <a href="https://www.mkdocs.org/">MkDocs</a> using a <a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<div class="rst-versions" role="note" aria-label="Versions">
<span class="rst-current-version" data-toggle="rst-current-version">
<span><a href="../operator_conf/" style="color: #fcfcfc">« Previous</a></span>
<span><a href="../storage/" style="color: #fcfcfc">Next »</a></span>
</span>
</div>
<script src="../js/jquery-3.6.0.min.js"></script>
<script>var base_url = "..";</script>
<script src="../js/theme_extra.js"></script>
<script src="../js/theme.js"></script>
<script src="../search/main.js"></script>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>