My kubernetes deployment not work as expected

3/22/2019

I want to download the cfg file to container and then use exec to replace my process, so that when my process crashes, the container can restart automatically because my process has pid 1. I can't pack the cfg into image due to some reason. The container is created successfully but it stucks and myExec doesn't start. Here is my yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  creationTimestamp: null
  labels:
    run: myPod
  name: myPod
spec:
  replicas: 1
  selector:
    matchLabels:
      run: myPod
  strategy: {}
  template:
    metadata:
      creationTimestamp: null
      labels:
        run: myPod
    spec:
      containers:
      - args:
        - sh
        - -c
        - wget http://x.x.x.x:12345/cfg.ini -O /etc/cfg.ini && exec myExec -c /etc/cfg.ini
        image: myimage
        name: myPod
        resources: {}
status: {}
-- Mr Pang
kubernetes

0 Answers