AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • Início
  • system&network
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • Início
  • system&network
    • Recentes
    • Highest score
    • tags
  • Ubuntu
    • Recentes
    • Highest score
    • tags
  • Unix
    • Recentes
    • tags
  • DBA
    • Recentes
    • tags
  • Computer
    • Recentes
    • tags
  • Coding
    • Recentes
    • tags
Início / server / Perguntas / 1147421
Accepted
Raphael10
Raphael10
Asked: 2023-11-08 19:46:04 +0800 CST2023-11-08 19:46:04 +0800 CST 2023-11-08 19:46:04 +0800 CST

Pods Statefulset: problema com múltiplas declarações de volume persistente

  • 772

Como tenho 5 pastas NFS compartilhadas:

   root@k8s-eu-1-master:~# df -h | grep /srv/
   aa.aaa.aaa.aaa:/srv/shared-k8s-eu-1-worker-1 391G 6.1G 365G 2% /mnt/data
   bb.bbb.bbb.bbb:/srv/shared-k8s-eu-1-worker-2 391G 6.1G 365G 2% /mnt/data
   cc.ccc.ccc.cc:/srv/shared-k8s-eu-1-worker-3 391G 6.1G 365G 2% /mnt/data
   dd.ddd.ddd.dd:/srv/shared-k8s-eu-1-worker-4 391G 6.1G 365G 2% /mnt/data
   ee.eee.eee.eee:/srv/shared-k8s-eu-1-worker-5 391G 6.1G 365G 2% /mnt/data

Adicionei em cassandra-statefulset.yaml o segundo volumeMount com seu volumeClaimTemplate:

  # These volume mounts are persistent. They are like inline claims,
  # but not exactly because the names need to match exactly one of
  # the stateful pod volumes.
  volumeMounts:
  - name: k8s-eu-1-worker-1
   mountPath: /srv/shared-k8s-eu-1-worker-1
  - name: k8s-eu-1-worker-2
   mountPath: /srv/shared-k8s-eu-1-worker-2

   # These are converted to volume claims by the controller
   # and mounted at the paths mentioned above.
   # do not use these in production until ssd GCEPersistentDisk or other ssd pd
   volumeClaimTemplates:
   - metadata:
     name: k8s-eu-1-worker-1
    spec:
     accessModes: [ "ReadWriteOnce" ]
     storageClassName: k8s-eu-1-worker-1
     resources:
      requests:
       storage: 1Gi
   - metadata:
     name: k8s-eu-1-worker-2
    spec:
     accessModes: [ "ReadWriteOnce" ]
     storageClassName: k8s-eu-1-worker-2
     resources:
       requests:
       storage: 1Gi

  ---
  kind: StorageClass
  apiVersion: storage.k8s.io/v1
  metadata:
   name: k8s-eu-1-worker-1
  provisioner: k8s-sigs.io/k8s-eu-1-worker-1
  parameters:
   type: pd-ssd

  kind: StorageClass
  apiVersion: storage.k8s.io/v1
  metadata:
   name: k8s-eu-1-worker-2
  provisioner: k8s-sigs.io/k8s-eu-1-worker-2
  parameters:
   type: pd-ssd

Parece funcionar bem no início:

   root@k8s-eu-1-master:~# kubectl apply -f ./cassandraStatefulApp/cassandra-statefulset.yaml 
   statefulset.apps/cassandra created

Mas o statefulset permanece em um estado "não pronto":

   root@k8s-eu-1-master:~# kubectl get sts
   NAME    READY AGE
   cassandra 0/3  17m

root@k8s-eu-1-master:~# kubectl describe sts cassandra
  Name:       cassandra
  Namespace:     default
  CreationTimestamp: Wed, 08 Nov 2023 12:02:10 +0100
  Selector:     app=cassandra
  Labels:      app=cassandra
  Annotations:    <none>
  Replicas:     3 desired | 1 total
  Update Strategy:  RollingUpdate
   Partition:    0
  Pods Status:    0 Running / 1 Waiting / 0 Succeeded / 0 Failed
  Pod Template:
   Labels: app=cassandra
   Containers:
    cassandra:
    Image:   gcr.io/google-samples/cassandra:v13
    Ports:   7000/TCP, 7001/TCP, 7199/TCP, 9042/TCP
    Host Ports: 0/TCP, 0/TCP, 0/TCP, 0/TCP
    Limits:
     cpu:  500m
     memory: 1Gi
    Requests:
     cpu:   500m
     memory: 1Gi
    Readiness: exec [/bin/bash -c /ready-probe.sh] delay=15s timeout=5s period=10s #success=1  
#failure=3
    Environment:
     MAX_HEAP_SIZE:     512M
     HEAP_NEWSIZE:      100M
     CASSANDRA_SEEDS:    cassandra-0.cassandra.default.svc.cluster.local
     CASSANDRA_CLUSTER_NAME: K8Demo
     CASSANDRA_DC:      DC1-K8Demo
     CASSANDRA_RACK:     Rack1-K8Demo
     POD_IP:         (v1:status.podIP)
    Mounts:
     /srv/shared-k8s-eu-1-worker-1 from k8s-eu-1-worker-1 (rw)
     /srv/shared-k8s-eu-1-worker-2 from k8s-eu-1-worker-2 (rw)
   Volumes: <none>
  Volume Claims:
   Name:     k8s-eu-1-worker-1
   StorageClass: k8s-eu-1-worker-1
   Labels:    <none>
   Annotations: <none>
   Capacity:   1Gi
   Access Modes: [ReadWriteOnce]
   Name:     k8s-eu-1-worker-2
   StorageClass: k8s-eu-1-worker-2
   Labels:    <none>
   Annotations: <none>
   Capacity:   1Gi
   Access Modes: [ReadWriteOnce]
  Events:
   Type  Reason      Age From          Message
   ----  ------      ---- ----          -------
   Normal SuccessfulCreate 18m statefulset-controller create Claim k8s-eu-1-worker-1-cassandra-0   
    Pod cassandra-0 in StatefulSet cassandra success
   Normal SuccessfulCreate 18m statefulset-controller create Claim k8s-eu-1-worker-2-cassandra-0 
    Pod cassandra-0 in StatefulSet cassandra success
   Normal SuccessfulCreate 18m statefulset-controller create Pod cassandra-0 in StatefulSet 
 cassandra successful

O pod correspondente permanece no estado "Pendente":

   root@k8s-eu-1-master:~# kubectl get pods
   NAME                               READY STATUS  RESTARTS AGE
   cassandra-0                           0/1  Pending 0     19m
   k8s-eu-1-worker-1-nfs-subdir-external-provisioner-79fff4ff2qx7k 1/1  Running 0     19h

  root@k8s-eu-1-master:~# kubetl describe pod cassandra-0
  kubetl: command not found
  root@k8s-eu-1-master:~# kubectl describe pod cassandra-0
  Name:      cassandra-0
  Namespace:    default
  Priority:    0
  Service Account: default
  Node:      <none>
  Labels:     app=cassandra
           apps.kubernetes.io/pod-index=0
           controller-revision-hash=cassandra-79d64cd8b
           statefulset.kubernetes.io/pod-name=cassandra-0
  Annotations:   <none>
  Status:     Pending
  IP:       
  IPs:       <none>
  Controlled By:  StatefulSet/cassandra
  Containers:
   cassandra:
    Image:   gcr.io/google-samples/cassandra:v13
    Ports:   7000/TCP, 7001/TCP, 7199/TCP, 9042/TCP
    Host Ports: 0/TCP, 0/TCP, 0/TCP, 0/TCP
    Limits:
     cpu:  500m
     memory: 1Gi
    Requests:
     cpu:   500m
     memory: 1Gi
    Readiness: exec [/bin/bash -c /ready-probe.sh] delay=15s timeout=5s period=10s #success=1  
#failure=3
    Environment:
     MAX_HEAP_SIZE:     512M
     HEAP_NEWSIZE:      100M
     CASSANDRA_SEEDS:    cassandra-0.cassandra.default.svc.cluster.local
     CASSANDRA_CLUSTER_NAME: K8Demo
     CASSANDRA_DC:      DC1-K8Demo
     CASSANDRA_RACK:     Rack1-K8Demo
     POD_IP:         (v1:status.podIP)
    Mounts:
     /srv/shared-k8s-eu-1-worker-1 from k8s-eu-1-worker-1 (rw)
     /srv/shared-k8s-eu-1-worker-2 from k8s-eu-1-worker-2 (rw)
     /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-wxx58 (ro)
  Conditions:
   Type     Status
   PodScheduled False 
  Volumes:
   k8s-eu-1-worker-1:
    Type:   PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName: k8s-eu-1-worker-1-cassandra-0
    ReadOnly: false
   k8s-eu-1-worker-2:
    Type:   PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName: k8s-eu-1-worker-2-cassandra-0
    ReadOnly: false
   kube-api-access-wxx58:
    Type:          Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds: 3607
    ConfigMapName:     kube-root-ca.crt
    ConfigMapOptional:   <nil>
    DownwardAPI:      true
  QoS Class:         Guaranteed
  Node-Selectors:       <none>
  Tolerations:        node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                 node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
  Events:
   Type  Reason      Age        From       Message
   ----  ------      ----       ----       -------
   Warning FailedScheduling 20m        default-scheduler 0/6 nodes are available: pod has unbound 
immediate PersistentVolumeClaims. preemption: 0/6 nodes are available: 6 Preemption is not helpful  
for scheduling..
   Warning FailedScheduling 10m (x3 over 20m) default-scheduler 0/6 nodes are available: pod has 
unbound immediate PersistentVolumeClaims. preemption: 0/6 nodes are available: 6 Preemption is not 
helpful for scheduling..

Com apenas uma das duas reivindicações de volume persistente no status "Ligado" e a outra ainda no status "Pendente":

  root@k8s-eu-1-master:~# kubectl get pvc
  NAME              STATUS  VOLUME                  CAPACITY ACCESS MODES STORAGECLASS    
AGE
  k8s-eu-1-worker-1-cassandra-0 Bound  pvc-4f1d877b-8e01-4b76-b4e1-25bc226fd1a5 1Gi    RWO         
  k8s-eu-1-worker-1 21m
  k8s-eu-1-worker-2-cassandra-0 Pending                                    k8s-eu-1-worker-2 21m

O que há de errado com minha cassandra-statefulset.yamlconfiguração acima?

kubernetes
  • 1 1 respostas
  • 25 Views

1 respostas

  • Voted
  1. Best Answer
    Raphael10
    2023-11-08T20:09:03+08:002023-11-08T20:09:03+08:00

    Minha culpa

    Eu não criei o segundok8s-eu-1-worker-2-nfs-subdir-external-provisioner

    Depois de criá-lo, o pod com estado entrou em estado de execução

    • 0

relate perguntas

  • Containerd falhou ao iniciar após Nvidia Config

  • Como posso modificar o configmap CoreDNS antes de inicializar o cluster usando o kubeadm?

Sidebar

Stats

  • Perguntas 205573
  • respostas 270741
  • best respostas 135370
  • utilizador 68524
  • Highest score
  • respostas
  • Marko Smith

    Você pode passar usuário/passar para autenticação básica HTTP em parâmetros de URL?

    • 5 respostas
  • Marko Smith

    Ping uma porta específica

    • 18 respostas
  • Marko Smith

    Verifique se a porta está aberta ou fechada em um servidor Linux?

    • 7 respostas
  • Marko Smith

    Como automatizar o login SSH com senha?

    • 10 respostas
  • Marko Smith

    Como posso dizer ao Git para Windows onde encontrar minha chave RSA privada?

    • 30 respostas
  • Marko Smith

    Qual é o nome de usuário/senha de superusuário padrão para postgres após uma nova instalação?

    • 5 respostas
  • Marko Smith

    Qual porta o SFTP usa?

    • 6 respostas
  • Marko Smith

    Linha de comando para listar usuários em um grupo do Windows Active Directory?

    • 9 respostas
  • Marko Smith

    O que é um arquivo Pem e como ele difere de outros formatos de arquivo de chave gerada pelo OpenSSL?

    • 3 respostas
  • Marko Smith

    Como determinar se uma variável bash está vazia?

    • 15 respostas
  • Martin Hope
    Davie Ping uma porta específica 2009-10-09 01:57:50 +0800 CST
  • Martin Hope
    kernel O scp pode copiar diretórios recursivamente? 2011-04-29 20:24:45 +0800 CST
  • Martin Hope
    Robert ssh retorna "Proprietário incorreto ou permissões em ~/.ssh/config" 2011-03-30 10:15:48 +0800 CST
  • Martin Hope
    Eonil Como automatizar o login SSH com senha? 2011-03-02 03:07:12 +0800 CST
  • Martin Hope
    gunwin Como lidar com um servidor comprometido? 2011-01-03 13:31:27 +0800 CST
  • Martin Hope
    Tom Feiner Como posso classificar a saída du -h por tamanho 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich O que é um arquivo Pem e como ele difere de outros formatos de arquivo de chave gerada pelo OpenSSL? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent Como determinar se uma variável bash está vazia? 2009-05-13 09:54:48 +0800 CST

Hot tag

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • Início
  • Perguntas
    • Recentes
    • Highest score
  • tag
  • help

Footer

AskOverflow.Dev

About Us

  • About Us
  • Contact Us

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve