148422597X Kubernetes Management Design Patterns [Vohra 2017-01-29] {E559F6BB}
Chapter 4 ■ Using Multiple ZonesCopy the following source code into claim.json:{"kind": "PersistentVolumeClaim","apiVersion": "v1","metadata": {"name": "claim1","annotations": {"volume.alpha.kubernetes.io/storage-class": "foo"}},"spec": {"accessModes": ["ReadWriteOnce"],"resources": {"requests": {"storage": "3Gi"}}}}The resulting claim1.json is shown in the vi editor in Figure 4-34.Figure 4-34. A PersistentVolumeClaim claim1.json113
Chapter 4 ■ Using Multiple ZonesCreate a PVC with the kubectl create command:kubectl create -f claim1.jsonList the persistent volumes, including labels:kubectl get pv --show-labelsThe persistent volume is listed as being consumed by the persistent volume claim:kubectl get pvcAs the command’s output indicates, a persistentvolumeclaim is created. The persistent volume islisted to be in the us-east-1b zone as shown in Figure 4-35.Figure 4-35. A PersistentVolumeClaim claim1.json114Next, define a pod specification that makes use of the PVC.sudo vi pod.yamlCopy the following code to pod.yaml:---apiVersion: v1kind: Podmetadata:name: nginxspec:containers:-image: nginxname: nginxvolumeMounts:-mountPath: /var/www/htmlname: pvvolumes:-
- Page 77 and 78: Chapter 3 ■ Kubernetes on Google
- Page 79 and 80: Chapter 3 ■ Kubernetes on Google
- Page 81 and 82: Chapter 3 ■ Kubernetes on Google
- Page 83 and 84: Chapter 3 ■ Kubernetes on Google
- Page 85 and 86: Chapter 3 ■ Kubernetes on Google
- Page 87 and 88: Chapter 3 ■ Kubernetes on Google
- Page 89 and 90: Chapter 3 ■ Kubernetes on Google
- Page 91 and 92: Chapter 3 ■ Kubernetes on Google
- Page 93 and 94: Chapter 3 ■ Kubernetes on Google
- Page 95 and 96: Chapter 3 ■ Kubernetes on Google
- Page 97 and 98: Chapter 3 ■ Kubernetes on Google
- Page 99 and 100: Chapter 3 ■ Kubernetes on Google
- Page 101 and 102: Chapter 3 ■ Kubernetes on Google
- Page 103 and 104: Chapter 3 ■ Kubernetes on Google
- Page 105 and 106: PART IIAdministration andConfigurat
- Page 107 and 108: Chapter 4 ■ Using Multiple ZonesS
- Page 109 and 110: Chapter 4 ■ Using Multiple ZonesF
- Page 111 and 112: Chapter 4 ■ Using Multiple ZonesF
- Page 113 and 114: Chapter 4 ■ Using Multiple ZonesA
- Page 115 and 116: Chapter 4 ■ Using Multiple ZonesF
- Page 117 and 118: Chapter 4 ■ Using Multiple ZonesR
- Page 119 and 120: Chapter 4 ■ Using Multiple ZonesF
- Page 121 and 122: Chapter 4 ■ Using Multiple ZonesF
- Page 123 and 124: Chapter 4 ■ Using Multiple ZonesL
- Page 125 and 126: Chapter 4 ■ Using Multiple ZonesF
- Page 127: Chapter 4 ■ Using Multiple ZonesI
- Page 131 and 132: Chapter 4 ■ Using Multiple ZonesA
- Page 133 and 134: Chapter 5 ■ Using the Tectonic Co
- Page 135 and 136: Chapter 5 ■ Using the Tectonic Co
- Page 137 and 138: Chapter 5 ■ Using the Tectonic Co
- Page 139 and 140: Chapter 5 ■ Using the Tectonic Co
- Page 141 and 142: Chapter 5 ■ Using the Tectonic Co
- Page 143 and 144: Chapter 5 ■ Using the Tectonic Co
- Page 145 and 146: Chapter 5 ■ Using the Tectonic Co
- Page 147 and 148: Chapter 5 ■ Using the Tectonic Co
- Page 149 and 150: Chapter 5 ■ Using the Tectonic Co
- Page 151 and 152: Chapter 6 ■ Using VolumesPodDocke
- Page 153 and 154: Chapter 6 ■ Using VolumesObtain t
- Page 155 and 156: Chapter 6 ■ Using VolumesFigure 6
- Page 157 and 158: Chapter 6 ■ Using VolumesThe prec
- Page 159 and 160: Chapter 6 ■ Using VolumesFigure 6
- Page 161 and 162: Chapter 6 ■ Using VolumesFigure 6
- Page 163 and 164: Chapter 6 ■ Using VolumesThe kube
- Page 165 and 166: Chapter 6 ■ Using Volumesvolumes:
- Page 167 and 168: Chapter 6 ■ Using VolumesChange d
- Page 169 and 170: Chapter 7 ■ Using ServicesAnother
- Page 171 and 172: Chapter 7 ■ Using ServicesCreatin
- Page 173 and 174: Chapter 7 ■ Using ServicesSimilar
- Page 175 and 176: Chapter 7 ■ Using ServicesList th
- Page 177 and 178: Chapter 7 ■ Using ServicesFigure
Chapter 4 ■ Using Multiple Zones
Copy the following source code into claim.json:
{
"kind": "PersistentVolumeClaim",
"apiVersion": "v1",
"metadata": {
"name": "claim1",
"annotations": {
"volume.alpha.kubernetes.io/storage-class": "foo"
}
},
"spec": {
"accessModes": [
"ReadWriteOnce"
],
"resources": {
"requests": {
"storage": "3Gi"
}
}
}
}
The resulting claim1.json is shown in the vi editor in Figure 4-34.
Figure 4-34. A PersistentVolumeClaim claim1.json
113