跳到主要内容

工作负载

测试 nginx 服务

apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:latest

---
apiVersion: v1
kind: Service
metadata:
name: nginx
labels:
app: nginx
spec:
type: ClusterIP
ports:
- port: 80
protocol: TCP
targetPort: 80
selector:
app: nginx

调度

apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
# 使用 nodeSelector 显式指定调度到超级节点
nodeSelector:
node.kubernetes.io/instance-type: eklet
containers:
- name: nginx
image: nginx:latest

网卡和 IP

如果集群网络模式是 Global Router,且启用了 VPC-CNI (两种模式混用),Pod 调度到普通节点默认使用 Global Router 模式,如需使用 VPC-CNI (弹性网卡),需显式指定:

apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
annotations:
tke.cloud.tencent.com/networks: tke-route-eni
spec:
containers:
- name: nginx
image: nginx:latest
resources:
requests:
tke.cloud.tencent.com/eni-ip: "1"
limits:
tke.cloud.tencent.com/eni-ip: "1"