在我的本地开发环境中,我已经使用CoreOS设置了Kube-Solo。我正在尝试部署包含持久卷声明模板的Kubernetes PetSet作为PetSet配置的一部分。此配置失败,并且没有任何pod已启动。这是我的PetSet定义:
apiVersion: apps/v1alpha1
kind: PetSet
metadata:
name: marklogic
spec:
serviceName: "ml-service"
replicas: 2
template:
metadata:
labels:
app: marklogic
annotations:
pod.alpha.kubernetes.io/initialized: "true"
spec:
terminationGracePeriodSeconds: 30
containers:
- name: 'marklogic'
image: {ip address of repo}:5000/dcgs-sof/ml8-docker-final:v1
imagePullPolicy: Always
command: ["/opt/entry-point.sh", "-l", "/opt/mlconfig.sh"]
ports:
- containerPort: 7997
name: health-check
- containerPort: 8000
name: app-services
- containerPort: 8001
name: admin
- containerPort: 8002
name: manage
- containerPort: 8040
name: sof-sdl
- containerPort: 8041
name: sof-sdl-xcc
- containerPort: 8042
name: ml8042
- containerPort: 8050
name: sof-sdl-admin
- containerPort: 8051
name: sof-sdl-cache
- containerPort: 8060
name: sof-sdl-camel
env:
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
lifecycle:
preStop:
exec:
command: ["/etc/init.d/MarkLogic stop"]
volumeMounts:
- name: ml-data
mountPath: /var/opt/MarkLogic
volumeClaimTemplates:
- metadata:
name: ml-data
annotations:
volume.alpha.kubernetes.io/storage-class: anything
spec:
accessModes: [ "ReadWriteMany" ]
resources:
requests:
storage: 1Gi
在Kubernetes仪表板中,我看到以下错误消息:
SchedulerPredicates failed due to PersistentVolumeClaim is not bound: "ml-data-marklogic-0", which is unexpected.
似乎无法创建持久卷声明也会阻止图像从我的本地存储库中拉出。此外,Kubernetes仪表板显示持久性卷声明的请求,但状态持续“待定”。 我已经验证了问题是持久卷声明。如果我从PetSet配置中删除它,则部署成功。
我应该注意到我在此之前使用的是MiniKube并且会看到相同的消息,但是一旦图像被拉出并且pod已经启动,声明将保持不变并且消息将消失。
我正在使用
答案 0 :(得分:2)
我不熟悉kube-solo。
但是,此处的问题可能是您尝试使用处于测试阶段的功能dynamic volume provisioning,该功能对您环境中的卷没有特定支持。
解决此问题的最佳方法是创建它希望手动查找的持久卷,以便PersistentVolumeClaim可以找到它们。
答案 1 :(得分:0)
同样的错误发生在我身上,并在slack group和this拉动下找到了关于以下配置(考虑 volumeClaimTemplates 和 StorageClass )的线索请求
volumeClaimTemplates:
- metadata:
name: cassandra-data
annotations:
volume.beta.kubernetes.io/storage-class: standard
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 1Gi
---
kind: StorageClass
apiVersion: storage.k8s.io/v1beta1
metadata:
namespace: kube-system
name: standard
annotations:
storageclass.beta.kubernetes.io/is-default-class: "true"
labels:
kubernetes.io/cluster-service: "true"
provisioner: kubernetes.io/host-path