我需要部署具有持久卷声明支持的pod,同时,我还需要支持pod的修改(编辑任意配置),还需要回滚到以前容器镜像版本的上一版本。
我看了一遍文档,但到处都是statefulset.yaml文件中包含的服务。
我不想要这里的服务,它应该只部署带有回滚支持的statefulset pod。你能帮助我给出任何示例状态集YAML文件吗
apiVersion: v1
kind: Service
metadata:
name: redis
namespace: default
......................
.................
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: redis
spec:

发布于 2020-07-20 12:07:36
实际上,这是StatefulSet的limitations之一,必须有headless service。✅
StatefulSets目前需要无头服务来负责Pod的网络身份。您负责创建此服务。
此外,如果您希望其他pod从Kubernetes集群中的其他pod或从集群外的某个位置访问您的Redis实例,这是必须的。
如果你不想使用服务,你可以将你的StatefulSet切换到普通的Deployment。
✌️
发布于 2020-07-20 12:05:50
只有当您想要公开应用程序时,才需要服务。如果没有服务,您只能通过集群内的IP访问您的statefulSet。您可以在official docs中找到更多详细信息。
您对PVC、编辑和回滚的需求是statefulset的内置功能(您只能编辑statefulset的几个字段),因此您可以开始工作了。
发布于 2020-07-20 12:38:41
根据接口,statefulset中的spec.serviceName是必需的。因此,你必须拥有它。
kubectl explain statefulset.spec.serviceName
KIND: StatefulSet
VERSION: apps/v1
FIELD: serviceName <string>
DESCRIPTION:
serviceName is the name of the service that governs this StatefulSet. This
service must exist before the StatefulSet, and is responsible for the
network identity of the set. Pods get DNS/hostnames that follow the
pattern: pod-specific-string.serviceName.default.svc.cluster.local where
"pod-specific-string" is managed by the StatefulSet controller.正如您在上面看到的,此服务必须在StatefulSet之前存在。
https://stackoverflow.com/questions/62988245
复制相似问题