AWS EKS with Fargate pod status pending due to PersistentVolumeClaim not found

那年仲夏 提交于 2020-12-15 07:44:20

问题


I have deployed EKS cluster with Fargate and alb-ingress-access using the following command:

eksctl create cluster --name fargate-cluster --version 1.17 --region us-east-2 --fargate --alb-ingress-access

A Fargate namespace has also been created.

The application being deployed has four containers namely mysql, nginx, redis and web.

The YAML files have been applied to the correct namespace.

The issue I am having is that after applying the YAML files when I get the pods status I the following status:

NAMESPACE     NAME                              READY   STATUS    RESTARTS   AGE
flipkicks     flipkicksdb-7669b44bbb-xww26      0/1     Pending   0          112m
flipkicks     flipkicksredis-74bbf9bd8c-p59hb   1/1     Running   0          112m
flipkicks     nginx-5b46fd5977-9d8wk            0/1     Pending   0          112m
flipkicks     web-56666f5d8-64w4d               1/1     Running   0          112m

MySQL and Nginx pods go into pending status. The deployment YAML for both have the following volumeMounts values:

MYSQL

volumeMounts:
        - mountPath: /var/lib/mysql
          name: mysql-db

NGINX

volumeMounts:
        - mountPath: "/etc/nginx/conf.d"
          name: nginx-conf
        - mountPath: "/var/www/html"
          name: admin-panel

The output from the events part of the kubectl describe command for both pods is:

MYSQL

Events:
Type     Reason            Age        From               Message
----     ------            ----       ----               -------
Warning  FailedScheduling  <unknown>  fargate-scheduler  Pod not supported on Fargate: volumes not supported: mysql-db not supported because: PVC mysql-db not bound

NGINX

Events:
Type     Reason            Age        From               Message
----     ------            ----       ----               -------
Warning  FailedScheduling  <unknown>  fargate-scheduler  Pod not supported on Fargate: volumes not supported: admin-panel is of an unsupported volume Type

Would really appreciate any help in understanding this problem and how to resolve it.


回答1:


Since your NGINX and MYSQL pods are requiring volumeMounts, you will need a PersistentVolumeClaim which is a request for storage from the PersistentVolume resource. Your pods can then use the claim as a volume, for more info see Kubernetes Persistent Volumes.

For the longest time EKS Fargate did not support persistent storage until Aug 17, 2020 when the AWS EFS CSI driver was introduced.

You will need to deploy the AWS EFS CSI driver and update your manifests to deploy the PersistentVolume, PersistentVolumeClaim and get your pods to use the claim as a volume. I would suggest starting with the Amazon EFS CSI driver guide to deploy the CSI driver into your EKS Fargate cluster and update your manifests to match the examples provided here.



来源:https://stackoverflow.com/questions/63809000/aws-eks-with-fargate-pod-status-pending-due-to-persistentvolumeclaim-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!