Docker/Kubernetes(Minikube)启动时间 - 挂载:未知文件系统类型“glusterfs”

Docker/Kubernetes(Minikube)启动时间 - 挂载:未知文件系统类型“glusterfs”

我正在尝试设置一个安装了 glusterfs 卷的 kubernetes/docker 容器(使用 Minikube),但每次我尝试启动服务/pod 时,错误日志中都会出现“mount:未知文件系统类型‘glusterfs’”。

但是,当我在 kubernetes 配置中没有设置卷的情况下启动容器时,将服务器的条目添加到 /etc/hosts,创建挂载点,然后手动挂载它,它工作正常。此外,尽管出现错误,但持久卷仍显示为已声明。

Statefulset

---
apiVersion: v1
kind: Service
metadata:
  name: backend-development
  labels:
    app: backend-development
spec:
  ports:
  - port: 80
    name: web
  clusterIP: None
  selector:
    app: backend-development

---
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
  name: backend-development
spec:
  serviceName: "backend-development"
  replicas: 3
  template:
    metadata:
      labels:
        app: backend-development
    spec:
      terminationGracePeriodSeconds: 10
      containers:
        - name: backend-development
          image: mount-test-gluster
          imagePullPolicy: Never
          ports:
            - containerPort: 80
              name: web
          securityContext:
            privileged: true
          volumeMounts:
            - name: certificates-storage
              mountPath: /etc/secrets
  volumeClaimTemplates:
  - metadata:
      name: certificates-storage
      annotations:
        volume.beta.kubernetes.io/storage-class: gluster-standard
    spec:
      accessModes: [ "ReadWriteMany" ]
      resources:
        requests:
          storage: 20Mi

Gluster 端点:

apiVersion: v1
kind: Endpoints
metadata:
  name: gluster-cluster 
subsets:
- addresses:              
  - ip: 10.108.162.33
  ports:                  
  - port: 1 # port number is ignored, but must be legal
    protocol: TCP

---
apiVersion: v1
kind: Service
metadata:
  name: gluster-cluster
spec:
  ports:
  - port: 1 # port number is ignored but must be legal

Gluster 存储类别:

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
    name: gluster-standard
provisioner: kubernetes.io/glusterfs
parameters:
    endpoint: "gluster-cluster"
    resturl: "http://10.108.162.33:8081"

持久卷配置:

apiVersion: v1
kind: PersistentVolume
metadata:
    name: certificates-storage
spec:
    capacity:
        storage: 20Mi
    accessModes:
        - ReadWriteMany
    glusterfs:
        endpoints: gluster-cluster
        path: /certificates-volume
        readOnly: false
    persistentVolumeReclaimPolicy: Retain
    storageClassName: gluster-standard

mount-test-gluster 的 Dockerfile:

FROM debian:stretch
MAINTAINER [email protected]

RUN apt update && apt upgrade -y && apt install -y nginx wget gnupg2 apt-transport-https

COPY glusterfs-client-install.sh /opt/
RUN /opt/glusterfs-client-install.sh

CMD ["nginx", "-g", "daemon off;"]

glusterfs-客户端安装.sh

#!/bin/bash
GLUSTER_VERSION='3.10'
wget -O - http://download.gluster.org/pub/gluster/glusterfs/${GLUSTER_VERSION}/rsa.pub | apt-key add -
echo deb http://download.gluster.org/pub/gluster/glusterfs/3.10/LATEST/Debian/stretch/apt stretch main > /etc/apt/sources.list.d/gluster.list 
apt update && apt install -y glusterfs-client

答案1

截至 2016 年底,这是一个已知问题。似乎有人尝试修复,但尚未发布,这意味着它存在错误。您可能需要继续手动安装一段时间。

你可以在这里关注这个错误: https://github.com/rancher/rancher/issues/4348

相关内容