Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In statefulset, declare to use pvc, the status of pvc is always pending #11240

Closed
RonaldFletcher opened this issue Nov 6, 2024 · 4 comments
Closed

Comments

@RonaldFletcher
Copy link

Environmental Info:
K3s Version:

v1.28.14+k3s1

Node(s) CPU architecture, OS, and Version:

Cluster Configuration:

Describe the bug:

In stafulsets, declare to use pvc, the status of pvc is always pending,but pod is running ,pvc pv is bound

apiVersion: apps/v1
kind: StatefulSet
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"apps/v1","kind":"StatefulSet","metadata":{"annotations":{},"name":"nginx-statefulset","namespace":"default"},"spec":{"replicas":1,"selector":{"matchLabels":{"app":"nginx"}},"serviceName":"nginx","template":{"metadata":{"labels":{"app":"nginx"}},"spec":{"containers":[{"image":"172.28.0.32:3443/xrwang/nginx:latest","imagePullPolicy":"IfNotPresent","name":"nginx","ports":[{"containerPort":80}],"volumeMounts":[{"mountPath":"/usr/share/nginx/html","name":"data"}]}]}},"volumeClaimTemplates":[{"apiVersion":"v1","kind":"PersistentVolumeClaim","metadata":{"annotations":{"path":"/share","value":"10"},"creationTimestamp":null,"name":"data"},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"10Gi"}},"storageClassName":"inner-nfs-sc"}}]}}
  creationTimestamp: "2024-11-06T01:39:25Z"
  generation: 1
  name: nginx-statefulset
  namespace: default
  resourceVersion: "2700347"
  uid: a3aa0b0f-4a18-4bd2-8962-ed0796e8546a
spec:
  persistentVolumeClaimRetentionPolicy:
    whenDeleted: Retain
    whenScaled: Retain
  podManagementPolicy: OrderedReady
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: nginx
  serviceName: nginx
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: nginx
    spec:
      containers:
      - image: nginx:latest
        imagePullPolicy: IfNotPresent
        name: nginx
        ports:
        - containerPort: 80
          protocol: TCP
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /usr/share/nginx/html
          name: data
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
  updateStrategy:
    rollingUpdate:
      partition: 0
    type: RollingUpdate
  volumeClaimTemplates:
  - apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
      annotations:
        path: /share
        value: "10"
      creationTimestamp: null
      name: data
    spec:
      accessModes:
      - ReadWriteOnce
      resources:
        requests:
          storage: 10Gi
      storageClassName: nfs-sc
      volumeMode: Filesystem
    status:
      phase: Pending
status:
  availableReplicas: 1
  collisionCount: 0
  currentReplicas: 1
  currentRevision: nginx-statefulset-68489d88f8
  observedGeneration: 1
  readyReplicas: 1
  replicas: 1
  updateRevision: nginx-statefulset-68489d88f8
  updatedReplicas:

Steps To Reproduce:

  • Installed K3s:

Expected behavior:

Actual behavior:

Additional context / logs:

@brandond
Copy link
Member

brandond commented Nov 6, 2024

storageClassName: nfs-sc

This is not a storageclass that comes with K3s. I suspect that whatever provisioner you're using to provision this volume is not working properly. Either that or perhaps the NFS server that is exporting the share is not configured properly.

Check the logs on your NFS provisioner, logs on the NFS server, and kubelet logs on the node where this volume should be mounted.

@brandond brandond closed this as completed Nov 6, 2024
@github-project-automation github-project-automation bot moved this from New to Done Issue in K3s Development Nov 6, 2024
@RonaldFletcher
Copy link
Author

use K3s. storageclass same problems

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: nginx-statefulset
spec:
  serviceName: "nginx"
  replicas: 1
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:latest
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 80
        volumeMounts:
        - name: data
          mountPath: /usr/share/nginx/html
  volumeClaimTemplates:
  - apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
      name: data
    spec:
      accessModes:
      - ReadWriteOnce
      resources:
        requests:
          storage: 10Gi

image

@RonaldFletcher
Copy link
Author

@brandond

@brandond
Copy link
Member

brandond commented Nov 6, 2024

Can you show the PVC or PV itself? What StorageClasses do you have available? What do the logs say? Anything useful at all?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done Issue
Development

No branches or pull requests

2 participants