kubernetes - k8s 如何关联 ReplicaSet 和 Pod?
问题描述
假设我有以下 k8s 配置文件,其中包含 2 个相同的部署,只是名称不同。
kind: Deployment
apiVersion: apps/v1
metadata:
labels:
app: hello-world
name: hello-world-deployment-1
spec:
replicas: 1
selector:
matchLabels:
app: hello-world
template:
metadata:
labels:
app: hello-world
spec:
containers:
- name: hello-world-2
image: rancher/hello-world:v0.1.2
resources:
limits:
cpu: "1"
memory: 100M
---
kind: Deployment
apiVersion: apps/v1
metadata:
labels:
app: hello-world
name: hello-world-deployment-2
spec:
replicas: 1
selector:
matchLabels:
app: hello-world
template:
metadata:
labels:
app: hello-world
spec:
containers:
- name: hello-world-2
image: rancher/hello-world:v0.1.2
resources:
limits:
cpu: "1"
memory: 100M
据我了解,k8s 通过标签关联 ReplicaSet 和 Pod。因此,有了上面的配置,我猜会有一些问题或者k8s会禁止这个配置。然而,事实证明一切都很好。除了标签之外,k8s 还有其他东西用来关联 ReplicaSet 和 Pod 吗?
解决方案
推荐阅读
- c# - EF 和 [JsonIgnore]:为什么我在使用现有类型时得到空字典,但在使用匿名类型时却没有?
- vue.js - 如何更改 v-tab-item 背景颜色?验证
- python - 将 API 输出导出到 txt 文件
- json - Spark 自动将 StringType 转换为 ArrayType
- grpc - grpc中的存根是什么意思?
- html - Mailchimp 表单字段内联显示不起作用
- latex - 如何在乳胶中正确对齐书写?
- .net - .NET 在运行时锁定所有程序集,甚至是未使用的程序集
- angular - 如何在Angular中使用反应形式内的值初始化数组
- visual-studio-code - Visual Studio Code Slack 错误消息 [Slack 错误消息]