Last active
February 19, 2021 00:22
-
-
Save msau42/d6e4c12e13eca716371516a477ce94d3 to your computer and use it in GitHub Desktop.
Dynamic provisioning autoscaling test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: storage.k8s.io/v1 | |
kind: StorageClass | |
metadata: | |
name: mysc | |
provisioner: kubernetes.io/gce-pd | |
reclaimPolicy: Delete | |
volumeBindingMode: WaitForFirstConsumer | |
parameters: | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: nginx | |
labels: | |
app: nginx | |
spec: | |
ports: | |
- port: 80 | |
name: web | |
clusterIP: None | |
selector: | |
app: nginx | |
--- | |
apiVersion: apps/v1 | |
kind: StatefulSet | |
metadata: | |
name: web | |
spec: | |
serviceName: "nginx" | |
replicas: 4 | |
selector: | |
matchLabels: | |
app: nginx | |
template: | |
metadata: | |
labels: | |
app: nginx | |
spec: | |
affinity: | |
podAntiAffinity: | |
requiredDuringSchedulingIgnoredDuringExecution: | |
- labelSelector: | |
matchExpressions: | |
- key: app | |
operator: In | |
values: | |
- nginx | |
topologyKey: kubernetes.io/hostname | |
containers: | |
- name: nginx | |
image: nginx | |
ports: | |
- containerPort: 80 | |
name: web | |
volumeMounts: | |
- name: www | |
mountPath: /usr/share/nginx/html | |
volumeClaimTemplates: | |
- metadata: | |
name: www | |
spec: | |
accessModes: [ "ReadWriteOnce" ] | |
storageClassName: mysc | |
resources: | |
requests: | |
storage: 10Gi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ k get nodes | |
NAME STATUS ROLES AGE VERSION | |
gke-cluster-1-default-pool-3a7dec17-ckfp Ready <none> 53m v1.17.15-gke.800 | |
gke-cluster-1-default-pool-3ee48415-s84m Ready <none> 53m v1.17.15-gke.800 | |
gke-cluster-1-default-pool-bd049a27-28nt Ready <none> 53m v1.17.15-gke.800 | |
$ k apply -f statefulset-autoscale-test.yaml | |
service/nginx created | |
statefulset.apps/web created | |
$ k get nodes | |
NAME STATUS ROLES AGE VERSION | |
gke-cluster-1-default-pool-3a7dec17-cgr9 Ready <none> 94s v1.17.15-gke.800 | |
gke-cluster-1-default-pool-3a7dec17-ckfp Ready <none> 77m v1.17.15-gke.800 | |
gke-cluster-1-default-pool-3ee48415-s84m Ready <none> 77m v1.17.15-gke.800 | |
gke-cluster-1-default-pool-bd049a27-28nt Ready <none> 77m v1.17.15-gke.800 | |
$ k get pods -o wide | |
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES | |
web-0 1/1 Running 0 21m 10.76.2.4 gke-cluster-1-default-pool-3ee48415-s84m <none> <none> | |
web-1 1/1 Running 0 20m 10.76.0.4 gke-cluster-1-default-pool-bd049a27-28nt <none> <none> | |
web-2 1/1 Running 0 20m 10.76.1.9 gke-cluster-1-default-pool-3a7dec17-ckfp <none> <none> | |
web-3 1/1 Running 0 20m 10.76.3.2 gke-cluster-1-default-pool-3a7dec17-cgr9 <none> <none> | |
$ k get pvc | |
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE | |
www-web-0 Bound pvc-5f6fd0d0-198d-4d05-87f3-9cce7a4ac990 10Gi RWO mysc 23m | |
www-web-1 Bound pvc-522116c1-3ee7-4f52-8181-1cafb75d555b 10Gi RWO mysc 22m | |
www-web-2 Bound pvc-b6b0af29-7cd7-4a31-bece-40a3d881097c 10Gi RWO mysc 21m | |
www-web-3 Bound pvc-10e1af63-d362-4f80-9005-8bc0ad00491b 10Gi RWO mysc 21m | |
$ k get sc | |
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE | |
mysc kubernetes.io/gce-pd Delete WaitForFirstConsumer false 46m | |
standard (default) kubernetes.io/gce-pd Delete Immediate true 97m | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment