gpt4 book ai didi

kubernetes - 如何创建基于架构部署的k8s部署文件

转载 作者:行者123 更新时间:2023-12-02 11:58:32 25 4
gpt4 key购买 nike

我编写了如下部署文件,这给我带来了错误:未知字段“平台”。您知道要指定什么以便基于架构进行部署吗?

apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.7.9
ports:
- containerPort: 80
platform:
architecture: amd64
os: linux
- name: nginx
image: ppc64le/nginx:1.7.9
ports:
- containerPort: 80
platform:
architecture: ppc64le
os: linux

最佳答案

您必须在部署规范中使用 nodeAffinity 定义。下面是我用来将任务固定到 amd64 或 arm 主机的示例:

  affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: beta.kubernetes.io/arch
operator: In
values:
- amd64

您可以使用任意键和值。这是documented example

关于kubernetes - 如何创建基于架构部署的k8s部署文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50404503/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com