(MoeLove) ➜ ~ export HELM_HOME=/tmp/helm3
(MoeLove) ➜ ~ helm3 init
Creating /tmp/helm3/repository
Creating /tmp/helm3/repository/cache
Creating /tmp/helm3/plugins
Creating /tmp/helm3/starters
Creating /tmp/helm3/cache/archive
Creating /tmp/helm3/repository/repositories.yaml
Adding stable repo with URL: https://kubernetes-charts.storage.googleapis.com
$HELM_HOME has been configured at /tmp/helm3.
Happy Helming!
(MoeLove) ➜ ~ helm3 list
NAME NAMESPACE REVISION UPDATED STATUS CHART
redis1 default 1 2019-05-17 00:21:06.686127031 +0800 CST deployed redis-7.1.0
redis default 1 2019-05-17 00:19:28.234013017 +0800 CST deployed redis-7.1.0
(MoeLove) ➜ ~ helm3 -n moelove install redis1 stable/redis
Error: cannot re-use a name that is still in use}}}
根源在於 Namespace 引數的獲取實現上。
對應程式碼為:
{{{func getNamespace() string {
if ns, _, err := kubeConfig().ToRawKubeConfigLoader().Namespace(); err == nil {
return ns
}
return "default" }
(MoeLove) ➜ ~ kubectl config current-context
kubernetes-admin@moelove
(MoeLove) ➜ ~ kubectl config set-context kubernetes-admin@moelove --namespace moelove
Context "kubernetes-admin@moelove" modified.
(MoeLove) ➜ ~ helm3 -n moelove install redis stable/redis
...# 省略輸出
(MoeLove) ➜ ~ helm3 list
NAME NAMESPACE REVISION UPDATED STATUS CHART
redis moelove 1 2019-05-17 00:26:44.572578745 +0800 CST deployed redis-7.1.0
(MoeLove) ➜ ~ helm3 install stable/redis
Error: must either provide a name or specify --generate-name
(MoeLove) ➜ ~ helm3 install stable/redis --generate-name
...# 省略輸出
(MoeLove) ➜ ~ helm3 list
NAME NAMESPACE REVISION UPDATED STATUS CHART
redis1 default 1 2019-05-17 00:21:06.686127031 +0800 CST deployed redis-7.1.0
redis-1558024567 default 1 2019-05-17 00:36:09.294632336 +0800 CST deployed redis-7.1.0
redis default 1 2019-05-17 00:19:28.234013017 +0800 CST deployed redis-7.1.0
朋友會在“發現-看一看”看到你“在看”的內容