AWS EKS:创建一个有状态集。每个副本在 EFS 上都有自己的持久存储

AWS EKS:创建一个有状态集。每个副本在 EFS 上都有自己的持久存储

我正在尝试在 AWS EKS 上部署一个具有 3 个副本的 statefulset,每个副本都有自己的持久存储(在 efs 上),这些持久存储是动态创建的。efs 服务器地址存储在 aws secrets manager 中。

但它不起作用。我收到以下错误:

警告 FailedScheduling 4m58s 默认调度程序 0/1 节点可用:pod 具有未绑定的即时 PersistentVolumeClaims。抢占:0/1 节点可用:1 抢占对于调度没有帮助。

任何帮助都将受到赞赏。

secrets-提供者类.yaml

apiVersion: secrets-store.csi.x-k8s.io/v1
kind: SecretProviderClass
metadata:
  name: aws-secrets-provider
spec:
  provider: aws
  parameters:
    objects:  |
      - objectName: "efs-server-address"
        objectType: secretsmanager
        objectVersion: ""

efs-storageclass.yaml

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: efs-storageclass
provisioner: secrets-store.csi.k8s.io
parameters:
  secretProviderClass: "aws-secrets-provider"

eks-secrets-manager-efs-sa.yaml

apiVersion: v1
kind: ServiceAccount
metadata:
  name: eks-secrets-manager-efs-sa
  annotations:
    eks.amazonaws.com/role-arn: arn:aws:iam::1234567890:policy/eks-secrets-manager-efs-policy

efs-pvc.yaml

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: efs-pvc
spec:
  accessModes:
    - ReadWriteMany
  storageClassName: efs-storageclass
  resources:
    requests:
      storage: 1Gi
  selector:
      matchLabels:
        fileSystemId: fs-0f012ab34567ab89c

statefulset-01.yaml

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: statefulset-01
  labels:
    app: app-sample-01
spec:
  replicas: 3
  selector:
    matchLabels:
      app: app-sample-01
  template:
    metadata:
      labels:
        app: app-sample-01
    spec:
      serviceAccountName: eks-secrets-manager-efs-sa
      containers:
        - name: container-sample-01
          image: '123456789000.dkr.ecr.us-east-1.amazonaws.com/sample-repo:latest'
          ports:
            - containerPort: 8080
          volumeMounts:
            - name: efs-volume
              mountPath: /data
  volumeClaimTemplates:
      - metadata:
          name: efs-volume
        spec:
          accessModes:
            - ReadWriteMany
          storageClassName: efs-storageclass
          resources:
            requests:
              storage: 1Gi

相关内容