我部署了一个helm chart,使用了十多天,但是当我今天使用它的时候,我发现pod was missing
,而状态集实例变成了0/0
。我通过kubectl rollout history
查看了历史,结果是1,没有修改过。造成这个问题的原因是什么?
PS:有些记录如下
kubectl get sts -n proxy
NAME READY AGE
sts-test 0/0 16d
$ kubectl rollout history sts/sts-test
statefulset.apps/sts-test
REVISION
1
kubectl get sts sts-test -o yaml
apiVersion: apps/v1
kind: StatefulSet
metadata:
creationTimestamp: "2022-06-09T03:22:23Z"
generation: 2
labels:
app.kubernetes.io/instance: sts-test-integration
app.kubernetes.io/managed-by: Tiller
app.kubernetes.io/name: sts-test
app.kubernetes.io/version: "1.0"
helm.sh/chart: sts-test-0.1.0
managedFields:
- apiVersion: apps/v1
fieldsType: FieldsV1
fieldsV1:
f:metadata:
f:labels:
.: {}
f:app.kubernetes.io/instance: {}
f:app.kubernetes.io/managed-by: {}
f:app.kubernetes.io/name: {}
f:app.kubernetes.io/version: {}
f:helm.sh/chart: {}
f:spec:
f:podManagementPolicy: {}
f:revisionHistoryLimit: {}
f:selector:
f:matchLabels:
.: {}
f:app.kubernetes.io/instance: {}
f:app.kubernetes.io/name: {}
f:serviceName: {}
f:template:
f:metadata:
f:labels:
.: {}
f:app.kubernetes.io/instance: {}
f:app.kubernetes.io/name: {}
f:spec:
f:containers:
k:{"name":"sts-test"}:
.: {}
f:image: {}
f:imagePullPolicy: {}
f:name: {}
f:ports:
.: {}
k:{"containerPort":3306,"protocol":"TCP"}:
.: {}
f:containerPort: {}
f:name: {}
f:protocol: {}
f:readinessProbe:
.: {}
f:failureThreshold: {}
f:initialDelaySeconds: {}
f:periodSeconds: {}
f:successThreshold: {}
f:tcpSocket:
.: {}
f:port: {}
f:timeoutSeconds: {}
f:resources: {}
f:securityContext: {}
f:terminationMessagePath: {}
f:terminationMessagePolicy: {}
f:volumeMounts:
.: {}
k:{"mountPath":"/data/mysql"}:
.: {}
f:mountPath: {}
f:name: {}
f:subPath: {}
k:{"mountPath":"/var/log/mysql"}:
.: {}
f:mountPath: {}
f:name: {}
f:subPath: {}
f:dnsPolicy: {}
f:restartPolicy: {}
f:schedulerName: {}
f:securityContext: {}
f:serviceAccount: {}
f:serviceAccountName: {}
f:terminationGracePeriodSeconds: {}
f:updateStrategy:
f:type: {}
f:volumeClaimTemplates: {}
manager: Go-http-client
operation: Update
time: "2022-06-09T03:22:23Z"
- apiVersion: apps/v1
fieldsType: FieldsV1
fieldsV1:
f:spec:
f:replicas: {}
manager: kubectl
operation: Update
time: "2022-06-24T11:37:22Z"
- apiVersion: apps/v1
fieldsType: FieldsV1
fieldsV1:
f:status:
f:collisionCount: {}
f:currentRevision: {}
f:observedGeneration: {}
f:replicas: {}
f:updateRevision: {}
manager: kube-controller-manager
operation: Update
time: "2022-06-24T11:37:24Z"
name: sts-test
namespace: proxy
resourceVersion: "5821333"
selfLink: /apis/apps/v1/namespaces/proxy/statefulsets/sts-test
uid: 8bb73b11-8ee9-44e1-8ead-f5b7c07c5f2e
spec:
podManagementPolicy: Parallel
replicas: 0
revisionHistoryLimit: 10
selector:
matchLabels:
app.kubernetes.io/instance: sts-test-integration
app.kubernetes.io/name: sts-test
serviceName: sts-test-svc
template:
metadata:
creationTimestamp: null
labels:
app.kubernetes.io/instance: sts-test-integration
app.kubernetes.io/name: sts-test
spec:
containers:
- image: sts-test-integration:v0.1.0
imagePullPolicy: IfNotPresent
name: sts-test
ports:
- containerPort: 3306
name: mysql
protocol: TCP
resources: {}
securityContext: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /data/mysql
name: sts-test-data
subPath: mysqldata-pvc
- mountPath: /var/log/mysql
name: sts-test-data
subPath: mysqllog-pvc
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
serviceAccount: sts-test
serviceAccountName: sts-test
terminationGracePeriodSeconds: 30
updateStrategy:
type: RollingUpdate
volumeClaimTemplates:
- apiVersion: v1
kind: PersistentVolumeClaim
metadata:
creationTimestamp: null
name: sts-test-data
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 50G
storageClassName: local-path
volumeMode: Filesystem
status:
phase: Pending
status:
collisionCount: 0
currentRevision: sts-test-6f95c95b57
observedGeneration: 2
replicas: 0
updateRevision: sts-test-6f95c95b57
...
- apiVersion: apps/v1
fieldsType: FieldsV1
fieldsV1:
f:spec:
f:replicas: {} # <-- replicas count has changed
manager: kubectl
operation: Update
time: "2022-06-24T11:37:22Z" # <-- at this time
...
kubectl scale statefulset sts-test --replicas=0
默认不创建新的历史记录。