mirror of https://github.com/k3s-io/k3s
62 lines
1.6 KiB
YAML
62 lines
1.6 KiB
YAML
{{$EnablePVs := DefaultParam .ENABLE_PVS false}}
|
|
|
|
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: {{.Name}}
|
|
labels:
|
|
group: load
|
|
spec:
|
|
podManagementPolicy: Parallel
|
|
selector:
|
|
matchLabels:
|
|
group: load
|
|
name: {{.Name}}
|
|
serviceName: {{.Name}}
|
|
replicas: {{RandIntRange .ReplicasMin .ReplicasMax}}
|
|
template:
|
|
metadata:
|
|
labels:
|
|
group: load
|
|
name: {{.Name}}
|
|
spec:
|
|
containers:
|
|
- name: {{.Name}}
|
|
image: registry.k8s.io/pause:3.1
|
|
ports:
|
|
- containerPort: 80
|
|
name: web
|
|
resources:
|
|
requests:
|
|
cpu: 10m
|
|
memory: "10M"
|
|
{{if $EnablePVs}}
|
|
volumeMounts:
|
|
- name: pv
|
|
mountPath: /var/pv
|
|
{{end}}
|
|
terminationGracePeriodSeconds: 1
|
|
# Add not-ready/unreachable tolerations for 15 minutes so that node
|
|
# failure doesn't trigger pod deletion.
|
|
tolerations:
|
|
- key: "node.kubernetes.io/not-ready"
|
|
operator: "Exists"
|
|
effect: "NoExecute"
|
|
tolerationSeconds: 900
|
|
- key: "node.kubernetes.io/unreachable"
|
|
operator: "Exists"
|
|
effect: "NoExecute"
|
|
tolerationSeconds: 900
|
|
{{if $EnablePVs}}
|
|
# NOTE: PVs created this way should be cleaned-up manually, as deleting the StatefulSet doesn't automatically delete PVs.
|
|
# To avoid deleting all the PVs at once during namespace deletion, they should be deleted explicitly via Phase.
|
|
volumeClaimTemplates:
|
|
- metadata:
|
|
name: pv
|
|
spec:
|
|
accessModes: [ "ReadWriteOnce" ]
|
|
resources:
|
|
requests:
|
|
storage: 100Mi
|
|
{{end}}
|