Windows AKS - Container lifecycle hooks

6/11/2020

I am trying to implment lifecycle hooks with windows AKS. setup deployment.yaml as below as part of helm, but after deployment, pod started successfully but did not run any lifecycle hook events (poststart in this case).. anyone able to implement this correctly.. any syntax errors in below file..

containers:
    - name: {{ .Values.deployment.name }}
      image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
      imagePullPolicy: {{ .Values.image.pullPolicy }}
      #{{- if eq (default .Values.env "prod") "stg" }}
      lifecycle:
        preStart:
          exec:
            command:
            - "powershell.exe"
            - "-command"
            - " wget '{{ .Values.config.connectionstringsasurl }}' -OutFile 'c:\\www\\sensei\\web\\ConnectionStrings.config' ; wget '{{ .Values.config.appsettingsasurl }}' -OutFile 'c:\\www\\sensei\\web\\AppSettings.config' ; "
        postStart:
          exec:
            command:
            - powershell.exe
            - -command
            - " wget '{{ .Values.config.connectionstringsasurl }}' -OutFile 'c:\\www\\sensei\\web\\ConnectionStrings.config' ; wget '{{ .Values.config.appsettingsasurl }}' -OutFile 'c:\\www\\sensei\\web\\AppSettings.config' ; "
      #{{- end }}
      ports:
      - containerPort: 85
-- Reddipalle Nagarjun
kubernetes
kubernetes-helm

0 Answers