知识卡片

普通读书笔记卡 · 3527.b

标签选择器须匹配模板

理解等级:中级

Deployment 的 selector 通过标签找其管理的 Pod,Pod 模板必须带有匹配标签;Service 也用 selector 找后端。若标签不一致,即使对象创建成功,也可能没有预期的实例或流量目标。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    原书出处

    参考来源

    - 位置:《Microservice APIs》第 14 章《Deploying microservice APIs with Kubernetes》(源文件:_epub-src/OEBPS/Text/14.htm) - 结论依据:原文同时展示 Deployment selector、Pod 模板标签及 Service selector 都使用 app: orders-service。 - 原始内容:In the spec section, we define a selector rule that matches pods with the label app: orders-service , which means this deployment will only operate pods with this label. We also declare that we’d like to run only one replica