Skip to content

Commit 750af20

Browse files
finally got postgres working with a custom storage class
1 parent 31ec5fa commit 750af20

2 files changed

Lines changed: 54 additions & 26 deletions

File tree

content/learning-paths/servers-and-cloud-computing/helm-on-gcp/gke-cluster-for-helm.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,58 @@ gke-helm-arm64-cluster-default-pool-f4ab8a2d-5ldp Ready <none> 5h54m v1
142142

143143
All nodes should be in **Ready** state and the Kubernetes control plane should be accessible.
144144

145+
### Taint the cluster nodes
146+
147+
Taint the nodes to ensure proper scheduling. For each node starting with **gke**, run the taint command. For example:
148+
149+
```console
150+
kubectl taint nodes gke-helm-arm64-cluster-default-pool-f4ab8a2d-5h6f kubernetes.io/arch=arm64:NoSchedule-
151+
kubectl taint nodes gke-helm-arm64-cluster-default-pool-f4ab8a2d-5ldp kubernetes.io/arch=arm64:NoSchedule-
152+
```
153+
154+
Replace the node names with your actual node names from the previous command output.
155+
156+
### Create hyperdisk storage class for our cluster
157+
158+
In order to use the c4a architecture with our cluster, a new storage class must be created.
159+
160+
Create a new file, hyperdisk.yaml, with this content:
161+
```yaml
162+
apiVersion: storage.k8s.io/v1
163+
kind: StorageClass
164+
metadata:
165+
name: my-hyperdisk-sc
166+
provisioner: pd.csi.storage.gke.io
167+
parameters:
168+
type: hyperdisk-balanced # Or hyperdisk-ssd, etc.
169+
reclaimPolicy: Delete
170+
volumeBindingMode: WaitForFirstConsumer
171+
```
172+
173+
Apply the hyperdisk.yaml file to the cluster:
174+
175+
```console
176+
kubectl apply -f ./hyperdisk.yaml
177+
```
178+
179+
Confirm that the new storage class has been added:
180+
181+
```console
182+
kubectl get storageclass
183+
```
184+
185+
The output should contain the new **my-hyperdisk-sc** storage class:
186+
187+
```output
188+
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
189+
my-hyperdisk-sc pd.csi.storage.gke.io Delete WaitForFirstConsumer false 7m27s
190+
premium-rwo pd.csi.storage.gke.io Delete WaitForFirstConsumer true 20m
191+
standard kubernetes.io/gce-pd Delete Immediate true 20m
192+
standard-rwo (default) pd.csi.storage.gke.io Delete WaitForFirstConsumer true 20m
193+
```
194+
195+
The new storage class will be used in the next section.
196+
145197
## What you've accomplished and what's next
146198

147199
You've successfully prepared your GKE environment by installing and configuring the Google Cloud SDK, creating a GKE cluster, connecting kubectl to the cluster, and verifying cluster access. Your environment is now ready to deploy applications using Helm charts.

content/learning-paths/servers-and-cloud-computing/helm-on-gcp/postgresql-helm.md

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ This approach prevents hard-coding credentials and follows Kubernetes security b
105105

106106
### Create pvc.yaml
107107

108-
Create `my-postgres/templates/pvc.yaml` with the following content to request persistent storage so PostgreSQL data remains available even if the pod restarts:
108+
Create `my-postgres/templates/pvc.yaml` with the following content to request persistent storage so PostgreSQL data remains available even if the pod restarts. Note the specification of the storage class that will be used **my-hyperdisk-sc** which was created and added to our cluster in the previous section. This hyperdisk-based storage class is required for the c4a architecture:
109109

110110
```yaml
111111
apiVersion: v1
@@ -115,6 +115,7 @@ metadata:
115115
spec:
116116
accessModes:
117117
- ReadWriteOnce
118+
storageClassName: my-hyperdisk-sc
118119
resources:
119120
requests:
120121
storage: {{ .Values.persistence.size }}
@@ -211,31 +212,6 @@ REVISION: 1
211212
TEST SUITE: None
212213
```
213214

214-
### Taint the nodes
215-
216-
Taint the nodes to ensure proper scheduling. First, list the nodes:
217-
218-
```console
219-
kubectl get nodes
220-
```
221-
222-
The output is similar to:
223-
224-
```output
225-
NAME STATUS ROLES AGE VERSION
226-
gke-helm-arm64-cluster-default-pool-7400f0d3-dq80 Ready <none> 10m v1.33.5-gke.2072000
227-
gke-helm-arm64-cluster-default-pool-7400f0d3-v3c9 Ready <none> 10m v1.33.5-gke.2072000
228-
```
229-
230-
For each node starting with **gke**, run the taint command. For example:
231-
232-
```console
233-
kubectl taint nodes gke-helm-arm64-cluster-default-pool-7400f0d3-dq80 kubernetes.io/arch=arm64:NoSchedule-
234-
kubectl taint nodes gke-helm-arm64-cluster-default-pool-7400f0d3-v3c9 kubernetes.io/arch=arm64:NoSchedule-
235-
```
236-
237-
Replace the node names with your actual node names from the previous command output.
238-
239215
### Check the runtime status
240216

241217
Check the pod and PVC status:

0 commit comments

Comments
 (0)