问题标签 [kubernetes-statefulset]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
docker - 无法在 Kubernetes 中更新 StatefulSet 的镜像
我最近用一个简单的测试项目评估了 Kubernetes,我能够使用如下命令更新 StatefulSet 的图像:
我现在正试图让我们的真实系统在 Kubernetes 中工作,当我尝试更新图像时,pod 没有做任何事情,即使我使用的是基本相同的命令。
它说:
statefulset.apps“云状态集”图像已更新
并kubectl describe statefulset.apps/cloud-stateful-set
说:
图片:ncccloud:v716"
但是kubectl describe pod cloud-stateful-set-0
说kubectl describe pod cloud-stateful-set-1
:
“图片:ncccloud:最新”
ncccloud:latest 是一个不起作用的图像:
另一个奇怪的事情是,每次我尝试应用 StatefulSet 时,它都会说已配置而不是未更改。
这是我的 cloud-stateful-set.yaml:
这是完整的输出kubectl describe pod/cloud-stateful-set-1
:
这是完整的输出kubectl describe statefulset.apps/cloud-stateful-set
:
如果重要的话,我在 Windows 上使用 Docker Desktop。
mongodb - 暴露和连接作为 K8S Statefulset 运行的 MongoDB ReplicaSet
我在 Kubernetes 中部署了一个 MongoDB ReplicaSet 作为 StatefulSet。我正在运行一个 Bare Metal K8S 集群,因此我使用 MetalLB 来公开 LoadBalancer 类型的服务。如果我的 MongoDB-RS 设置暴露服务如下所示:
这可以按预期工作,但是从外部客户端连接到 RS 时出现问题:
在某些时候它说“将主机更改为 rs0/10.42.2.155:27017,10.42.3.147:27017,10.42.4.108:27017”。由于这些 IP 是集群内部的,因此在此之后连接将失败。
有什么建议我能做什么?
kubernetes - 具有 hostPath 卷的 Kubernetes 状态集
我是 Kubernetes 新手,所以可能是一个愚蠢的问题。
我正在尝试使用 3 个 pod 副本部署 ElasticSearch 的 statefulset。我在规范中用 pvc 定义了 Statefulset。
此 pvc 具有由 hostPath 卷提供服务的存储类。
我几乎没有疑问。
1) 上面的 setup/pv 会分别在每个节点上提供 /host/abc 目录吗?即每个 pod 数据都将存储在其相应的节点/主机路径上。另外,k8s 会显示一个卷绑定到多个 pvc 吗?
2)当我使用statefulset时,我假设一次pod-{i}被安排在节点-{i}上,它在任何情况下都会被安排在那里(例如重新启动)。
3)以上设置正确的方法来实现我需要将数据存储在主机本地目录上的这种情况。还是本地持久卷更好?我无法得到两者之间的实际区别。4)我需要手动创建本地存储存储类吗?(以上设置在 docker for windows setup 中运行良好,无需创建存储类) 5)我可能还有其他容器也需要将数据存储在 /home/abc 目录下。因此,我将在容器中安装卷时使用 subPath。你看到这里有什么问题吗?
请帮忙。
kubernetes - 在 kubernetes statefulset 中为 pod 设置自定义序号,而不是默认的 0
在 Kubernetes statefulset 中,序号以 0 --> N 开头。有没有什么方法可以将起始序号设置为自定义数字。
kubernetes - 忽略节点的节点亲缘关系
我有 3 个节点,每个节点都标记如下:
- node-0 -> mongo-volume=volume-0
- 节点 1 -> mongo-volume=volume-1
- 节点 2 -> mongo-volume=volume-2
我正在寻找一种在特殊节点上安排 statefulset 副本的方法。
我首先使用 requiredDuringSchedulingIgnoredDuringExecution 的硬方法,一切正常。
然后我想通过使用preferredDuringSchedulingIgnoredDuringExecution来测试软方式。
我首先告诉我的 statefulset 优先选择具有标签volume-0的节点,没有问题,pod 都部署在node-0上。
然后我更改了对具有标签volume-1的节点的偏好。还有我的问题,pod 部署在node-0和node-2上,但node-1上的节点。
我对标签 volume-2 做了同样的事情,它再次运行良好,pod 都部署在node-2上。
节点亲和性配置:
当我查看节点的资源使用情况时,我注意到 node-1 的负载比其他节点多一些。它可以解释为什么调度程序拒绝在这个节点上部署 pod 吗?
我想知道为什么它适用于节点 0 和节点 2,但不适用于节点 1。如果有可能的方法来解决它。
prometheus - 有状态集的 RollingUpdate 不会重新启动 pod,并且来自更新的 ConfigMap 的更改不会反映
我正在使用 Prometheus 和 Prometheus Alertmanager 发送警报。
我已经在 GKE 上运行了 Kubernetes 状态集。我更新了 Prometheus 和 Prometheus AlertManager 的 ConfigMap,并对有状态集进行了 RollingUpdate,但是 pod 没有重新启动,而且它似乎仍在使用旧的 ConfigMap。
我使用了更新 ConfigMaps 的命令
kubectl create configmap prometheus-alertmanager-config --from-file alertmanager.yml -n mynamespace -o yaml --dry-run | kubectl replace -f -
同样,我也为 Prometheus 进行了更新。
对于 RollingUpdate,我使用了以下命令:
kubectl patch statefulset prometheus-alertmanager -p '{"spec":{"updateStrategy":{"type":"RollingUpdate"}}}' -n mynamespace
另外,当我做 rollingUpdate 它显示
statefulset.apps/prometheus-alertmanager patched (no change)
我不知道发生了什么,是否无法通过 RollingUpdate 使有状态集中的 pod 适应更新的 ConfigMap?或者我在这里遗漏了什么?
mongodb - 创建 mongodb 副本集时出错 - 显示无法识别的选项“--smallfiles”
我正在创建以下 mongodb statefulset,它创建 3 个副本,但是当我运行代码时,出现以下错误,并且所有 pod 都处于 CrashLoopBackOff 状态。
这是我尝试 kubectl create -f 时遇到的错误
kubernetes - Issues with Ports on headless service attached to Stateless Set
Hi I am trying to expose 5 ports for an Informix Container which is within a statefulSet. It has a headless service attached, to allow other internal stateless sets communicate with it internally.
I can ping the headless service informix-set-service
from my informix-0
pod and other pods however when I try nmap -p 9088 informix-set-service
the port is listed as closed. I am assuming this is because my yaml is wrong but I can't for the life find out where it's wrong.
It appears that the headless service is indeed attached and pointing at the correct stateful-set and within the minikube dashboard everything looks and appears to be correct.
Service minikube dash screenshot
Anyone got any ideas?
Deployment yaml snippet:
Edit 1: (added output of ss -lnt)
postgresql - minikube postgres statefulset 错误 - 致命:角色“密码 =”不存在
我在这里使用 Arianit Uka 的 Kubernetes Postgres StateulSet 示例存储库: https ://github.com/arianitu/postgres-statefulset
使用 minikube 并且我的 pod 容器没有出现。秘密已被应用,它似乎有POSTGRES_PASSWORD
env var 就好了。回购代码中没有password=
,所以我迷失了问题所在。检查日志给出了这个:
minikube 仪表板如下所示:
@Rahman,我取出了密码,现在在statefulset-master.yml
and中只使用普通值statefulset-replica.yml
:
我还注释掉了副本部分,service.yml
因为我目前只对运行单个 pod/数据库感兴趣:
服务.yml
statefulset-master.yml
statefulset-replica.yml
配置/create_configmap.sh
配置/创建副本用户.sh
这是我开始/应用资源的顺序:
minikube start
cd config
除非我在执行此操作时位于配置目录中,否则我会收到一些丢失的错误. ./create_configmap.sh
cd ..
k apply -f ./config/secret.yml
k apply -f ./service.yml
k apply -f ./statefulset-master.yml
链接到我的postgres-statefulset
repo 分支:
https ://gitlab.com/mikeumus/postgres-statefulset