> For the complete documentation index, see [llms.txt](https://advwacloud.gitbook.io/rd-newbie-guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://advwacloud.gitbook.io/rd-newbie-guide/ci-cd/k8s_faq.md).

# k8s FAQ

## - 如何升級客戶舊的chart, 會連動更新resources嗎?

&#x20;用helm upgrade

* 除了更新chart之外, 還會連動更新resources
* 有彈性的values覆寫與保留機制, ex. reset-values, reuse-values, --set.......

強烈建議先讀這兩篇

* <https://medium.com/@kcatstack/understand-helm-upgrade-flags-reset-values-reuse-values-6e58ac8f127e>
* <https://helm.sh/docs/helm/helm_upgrade/>

upgrade時可能會遇到一些問題, 解法如下

* <https://github.com/helm/helm/pull/7649>
* <https://stackoverflow.com/questions/58602311/will-helm-upgrade-restart-pods-even-if-they-are-not-affected-by-upgrade>
* <https://github.com/helm/helm/issues/5430>
* <https://github.com/helm/helm/issues/6378>

這裡提供一個範例

```
helm upgrade datahub-dev datahub --repo "https://harbor.arfa.wise-paas.com/chartrepo/datahub" --version 2.0.6 --reuse-values --set portal.image.tag=2.0.6 --set worker.image.tag=2.0.5 -n adviiotse

```

參數說明

* \--force: 強制重建resources
* \--reuse-values: 上一版values有的參數要保留
* \--set worker.image.tag=2.0.5: 單獨針對這個欄位更新值

**NOTE**

* 這個範例應該可以套用到絕大部分客戶升級chart的情境,
* 但有風險是, 如果中途有人直接edit資源, 那helm upgrade只要一重建, 就會重新套用chart release的values, 但其實本來就不應該直接edit resources, 比較好的流程是去upgrade chart, 即便只有改env也是, 這樣才有歷程記錄, 而且還可以rollback

## - 如何解出app使用的secret

kubectl get secret scada-allsvc-secret -o yaml

每個namespace的多合一secret名稱不一定相同, "scada-allsvc-secret1" 不是固定的

## - 如何使用還沒進版的node module#\#

## - 別人幫我佈好app了, 但我想要調整資源(例如 cpu ram), 怎麼辦?

edit deployment

## - 別人跟我要"chart 檔案" 怎辦

helm pull到lock成壓縮檔

## - 舊版的chart不見了, 怎麼辦, 可以重包嗎

可以,

1. 先去helm chart build 專案, 找到需要的tag, 開一個branch
2. 到jenkins pipeline, 改branch, 改成剛剛拉出來的
3. 手動觸發pipeline, 要填版號
