K8S initContainer 2020-02-25 k8s initContainer, k8s 0 Comments k8s 可以通过init container来在容器启动之前执行一下初始化之类的操作,initContainers中的容器将按照顺序执行,并在上一个退出后执行下一个,所有容器安全运行结束后启动spec中的容器。 123456789101112131415161718apiVersion: v1kind: Podmetadata: name: xiemx labels: app: xiemxspec: containers: - name: xiemx image: busybox command: ['sh', '-c', 'echo running && sleep 60'] initContainers: - name: init-1 image: busybox command: ['sh', '-c', 'echo init container 1'] - name: init-2 image: busybox command: ['sh', '-c', 'echo init container 2']