InvalidApplicationUID
当工作负载以用户 ID (UID) `1337` 运行时,会出现此消息。应用程序 Pod 不应该以用户 ID (UID) `1337` 运行,因为 istio-proxy 容器以 UID `1337` 运行。使用相同的 UID 运行应用程序容器会导致与其 `iptables` 配置冲突。
一个例子
考虑使用在 Pod 级别或容器级别使用 UID `1337` 运行 `securityContext.runAsUser` 的 `Deployment`
apiVersion: apps/v1
kind: Deployment
metadata:
name: deploy-con-sec-uid
labels:
app: helloworld
version: v1
spec:
replicas: 1
selector:
matchLabels:
app: helloworld
version: v1
template:
metadata:
labels:
app: helloworld
version: v1
spec:
securityContext:
runAsUser: 1337
containers:
- name: helloworld
image: docker.io/istio/examples-helloworld-v1
securityContext:
runAsUser: 1337
resources:
requests:
cpu: "100m"
imagePullPolicy: IfNotPresent #Always
ports:
- containerPort: 5000
如何解决
由于用户 ID (UID) `1337` 为边车代理保留,因此您可以使用不同的用户 ID (UID),例如 `1338`,作为您的工作负载。
apiVersion: apps/v1
kind: Deployment
metadata:
name: deploy-con-sec-uid
labels:
app: helloworld
version: v1
spec:
replicas: 1
selector:
matchLabels:
app: helloworld
version: v1
template:
metadata:
labels:
app: helloworld
version: v1
spec:
securityContext:
runAsUser: 1338
containers:
- name: helloworld
image: docker.io/istio/examples-helloworld-v1
securityContext:
runAsUser: 1338
resources:
requests:
cpu: "100m"
imagePullPolicy: IfNotPresent #Always
ports:
- containerPort: 5000