89. Rolling Updates and Rollbacks


請參考 CKAD Note Section 6 Pod Design 82. Rolling Updates & Rollbacks in Deployments


93. Commands


請參考 CKAD Note Section 3 Configuration 37. [Pre-Request] Commands and Arguments in Docker


97. Configure Environment Variables in Applications


請參考 CKAD Note Section 3 Configuration 42. Enviroment Variables


98. Configuring ConfigMaps in Applications


請參考 CKAD Note Section 3 Configuration 42. Enviroment Variables


101. Configure Secrets in Applications


請參考 CKAD Note Section 3 Configuration 42. Enviroment Variables


110. InitContainers


pod.spec.initContainers[] 可以幫助我們 在正式 container run 起來之前,先執行一個有特定目標的 container。 兩個差異:

  • initContainers 會變成 completion 狀態。
  • 前一個 initContainers 執行完成後,下一個才會開始。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
    apiVersion: v1
    kind: Pod
    metadata:
      name: myapp-pod
      labels:
        app: myapp
    spec:
      containers:
      - name: myapp-container
        image: busybox:1.28
        command: ['sh', '-c', 'echo The app is running! && sleep 3600']
      initContainers:
      - name: init-myservice
        image: busybox
        command: ['sh', '-c', 'git clone <some-repository-that-will-be-used-by-application> ; done;']