我们根据项目要求成功创建了pod,服务和复制控制器。现在我们计划使用Kubernetes在AWS中设置持久性存储。我创建了YAML文件以在AWS中创建EBS卷,它正如预期的那样正常工作。我可以声明音量并成功安装到我的pod(这仅适用于单个副本)。
我的档案存储:
kind: StorageClass
apiVersion: storage.k8s.io/v1beta1
metadata:
name: mongo-ssd
provisioner: kubernetes.io/aws-ebs
parameters:
type: gp2
主档案:
apiVersion: v1
kind: ReplicationController
metadata:
labels:
name: mongo-pp
name: mongo-controller-pp
spec:
replicas: 2
template:
metadata:
labels:
name: mongo-pp
spec:
containers:
- image: mongo
name: mongo-pp
ports:
- name: mongo-pp
containerPort: 27017
hostPort: 27017
volumeMounts:
- name: mongo-data
mountPath: "/opt/couchbase/var"
volumeClaimTemplates:
- metadata:
name: mongo-data
annotations:
volume.alpha.kubernetes.io/storage-class: mongo-ssd
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 1Gi
存储已成功创建。每当我尝试运行主文件时,我都会面临如下错误:
错误:无法识别“。”:没有匹配的应用/, 样= ReplicationController
有人可以帮我解决这个问题吗?