Estou tentando configurar um contêiner kubernetes / docker (usando Minikube) com um volume glusterfs montado, mas toda vez que tento iniciar o serviço / pods eu recebo "mount: o tipo de sistema de arquivos desconhecido 'glusterfs'" no registros de erros.
No entanto, quando inicio o contêiner sem a configuração de volumes na configuração do kubernetes, inclua uma entrada para o servidor em / etc / hosts, crie um ponto de montagem e, em seguida, monte-o manualmente. Além disso, o volume persistente é mostrado conforme reivindicado, apesar de ter cometido erros.
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
Ponto final da 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
Classe de armazenamento do 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"
Configuração do PersistentVolume:
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
Dockerfile para mount-test-gluster:
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-client-install.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