以下是一个完整的pod清单示例,可以参考进行修改使用。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
| apiVersion: v1 kind: Pod metadata: name: all-in-one namespace: default spec: initContainers: - name: iptables-init image: ikubernetes/admin-box:latest imagePullPolicy: IfNotPresent command: ['/bin/sh','-c'] args: ['iptables -t nat -A PREROUTING -p tcp --dport 8080 -j REDIRECT --to-port 80'] securityContext: capabilities: add: - NET_ADMIN containers: - name: sidecar-proxy image: envoyproxy/envoy-alpine:v1.13.1 command: ['/bin/sh','-c'] args: ['sleep 3 && envoy -c /etc/envoy/envoy.yaml'] lifecycle: postStart: exec: command: ['/bin/sh','-c','wget -O /etc/envoy/envoy.yaml http://ilinux.io/envoy.yaml'] livenessProbe: tcpSocket: port: 80 initialDelaySeconds: 5 readinessProbe: tcpSocket: port: 80 initialDelaySeconds: 5 - name: demo image: ikubernetes/demoapp:v1.0 imagePullPolicy: IfNotPresent env: - name: PORT value: '8080' - name: HOST value: '127.0.0.1' livenessProbe: httpGet: path: '/livez' port: 8080 initialDelaySeconds: 5 readinessProbe: httpGet: path: '/readyz' port: 8080 initialDelaySeconds: 5 securityContext: runAsUser: 1001 runAsGroup: 1001 resources: requests: cpu: 0.5 memory: "64Mi" limits: cpu: 2 memory: "1024Mi" securityContext: supplementalGroups: [1002,1003] fsGroup: 2000
|