InvalidApplicationUID
當工作負載以使用者 ID (UID) 1337
執行時,會發生此訊息。應用程式 Pod 不應以使用者 ID (UID) 1337
執行,因為 istio-proxy 容器以 UID 1337
執行。使用相同的 UID 執行應用程式容器會導致與其 iptables
設定衝突。
範例
考慮使用 securityContext.runAsUser
以 UID 1337
在 Pod 層級或容器層級執行的 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
保留給邊車 Proxy,您可以為您的工作負載使用不同的使用者 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