我正在尝试为k8s中的Solr部署配置PVC并将其挂载为/ opt / solr,这是默认的Solr安装目录。这样我计划在PVC上将Solr安装和数据作为目标。但是,虽然存储配置正常并且状态设置已创建,但我的部署不起作用,因为/ opt / solr最终为空。什么是正确的方法呢?这是我的deployment.yaml:
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
name: solr
labels:
app: solr
spec:
volumeClaimTemplates:
- metadata:
name: datadir
annotations:
volume.alpha.kubernetes.io/storage-class: slow
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 2Gi
serviceName: solr-svc
replicas: 1
template:
metadata:
labels:
app: solr
spec:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: "app"
operator: In
values:
- solr-pool
topologyKey: "kubernetes.io/hostname"
terminationGracePeriodSeconds: 300
containers:
- name: solr
image: solr:6.5.1
imagePullPolicy: IfNotPresent
resources:
requests:
memory: 512M
cpu: 500m
ports:
- containerPort: 8983
name: solr-port
protocol: TCP
env:
- name: VERBOSE
value: "yes"
command:
- bash
- -c
- "exec /opt/solr/bin/solr start"
volumeMounts:
- name: solr-script
mountPath: /docker-entrypoint-initdb.d/
- name: datadir
mountPath: /opt/solr/
volumes:
- name: solr-script
configMap:
name: solr-configs
nodeSelector:
pool: solr-pool
答案 0 :(得分:0)
默认情况下,预配存储为空,配置存储上可能存在Deleting
保留策略,请务必检查这些配置。您还可以exec
到您的pod并检查已装入的卷,看它是否正常工作(权限问题,只读文件系统)
答案 1 :(得分:0)
在可能的情况下,与docker容器配置存在冲突,该配置使用/ opt / solr作为solr安装的位置,并且我尝试在相同位置下安装单独的PV。一旦安装了这个PV,我显然松了solr安装。对此的修复是: