kubernetes helm 試用

各個 node上 下載 helm tiller docker image

docker pull registry.cn-hangzhou.aliyuncs.com/google-containers/tiller:v2.2.0
docker tag registry.cn-hangzhou.aliyuncs.com/google-containers/tiller:v2.2.0 gcr.io/kubernetes-helm/tiller:v2.2.0

k8s master上下載helm

https://storage.googleapis.com/kubernetes-helm/helm-v2.2.0-linux-amd64.tar.gz
tar -xvf helm-v2.2.0-linux-amd64.tar.gz && mv ./linux-amd64/helm /usr/bin/helm

helm 初始化

helm init
(上述命令有可能失敗淳梦,如
Error: Looks like "https://kubernetes-charts.storage.googleapis.com" is not a valid chart repository or cannot be reached: Get https://kubernetes-charts.storage.googleapis.com/index.yaml: dial tcp 74.125.204.128:443: i/o timeout
可稍后重試)

查看tiller-depoy 啟動狀態(tài)
kubectl get pods --namespace=kube-system -o wide

helm試用

[root@cloud4ourself-kcluster1 ~]# helm version
Client: &version.Version{SemVer:"v2.2.0", GitCommit:"fc315ab59850ddd1b9b4959c89ef008fef5cdf89", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.2.0", GitCommit:"fc315ab59850ddd1b9b4959c89ef008fef5cdf89", GitTreeState:"clean"}

獲取charts

[root@cloud4ourself-kcluster1 ~]# helm search  mysql
NAME            VERSION DESCRIPTION
stable/mysql    0.2.5   Fast, reliable, scalable, and easy to use open-...
stable/mariadb  0.5.10  Fast, reliable, scalable, and easy to use open-...
[root@cloud4ourself-kcluster1 ~]#
[root@cloud4ourself-kcluster1 ~]#
[root@cloud4ourself-kcluster1 ~]# helm install stable/mariadb
NAME:   hazy-heron
LAST DEPLOYED: Wed Mar 15 10:58:20 2017
NAMESPACE: default
STATUS: DEPLOYED

RESOURCES:
==> v1/Secret
NAME                TYPE    DATA  AGE
hazy-heron-mariadb  Opaque  2     0s

==> v1/ConfigMap
NAME                DATA  AGE
hazy-heron-mariadb  1     0s

==> v1/PersistentVolumeClaim
NAME                STATUS   VOLUME  CAPACITY  ACCESSMODES  AGE
hazy-heron-mariadb  Pending  0s

==> v1/Service
NAME                CLUSTER-IP      EXTERNAL-IP  PORT(S)   AGE
hazy-heron-mariadb  10.100.193.197  <none>       3306/TCP  0s

==> extensions/v1beta1/Deployment
NAME                DESIRED  CURRENT  UP-TO-DATE  AVAILABLE  AGE
hazy-heron-mariadb  1        1        1           0          0s


NOTES:
MariaDB can be accessed via port 3306 on the following DNS name from within your cluster:
hazy-heron-mariadb.default.svc.cluster.local

To connect to your database:

1. Run a pod that you can use as a client:

    kubectl run hazy-heron-mariadb-client --rm --tty -i --image bitnami/mariadb --command -- bash

2. Connect using the mysql cli, then provide your password:
    $ mysql -h hazy-heron-mariadb

查看新增pod
kubectl get pod
kubectl describe pod hazy-heron-mariadb-239282535-t501b

Events:
  FirstSeen LastSeen    Count   From            SubObjectPath   Type        Reason          Message
  --------- --------    -----   ----            -------------   --------    ------          -------
  19m       24s     70  {default-scheduler }            Warning     FailedScheduling    [SchedulerPredicates failed due to PersistentVolumeClaim is not bound: "hazy-heron-mariadb", which is unexpected., SchedulerPredicates failed due to PersistentVolumeClaim is not bound: "hazy-heron-mariadb", which is unexpected., SchedulerPredicates failed due to PersistentVolumeClaim is not bound: "hazy-heron-mariadb", which is unexpected.]

錯誤原因為:

[root@cloud4ourself-kcluster1 ~]# kubectl describe pvc hazy-heron-mariadb
Name:       hazy-heron-mariadb
Namespace:  default
StorageClass:   default
Status:     Pending
Volume:
Labels:     app=hazy-heron-mariadb
        chart=mariadb-0.5.10
        heritage=Tiller
        release=hazy-heron
Capacity:
Access Modes:
Events:
  FirstSeen LastSeen    Count   From                SubObjectPath   Type        Reason          Message
  --------- --------    -----   ----                -------------   --------    ------          -------
  1h        53m     65  {persistentvolume-controller }          Warning     ProvisioningFailed  cannot find volume plugin for alpha provisioning
  52m       52m     2   {persistentvolume-controller }          Warning     ProvisioningFailed  cannot find volume plugin for alpha provisioning
  51m       26m     99  {persistentvolume-controller }          Warning     ProvisioningFailed  cannot find volume plugin for alpha provisioning
  24m       9s      98  {persistentvolume-controller }          Warning     ProvisioningFailed  cannot find volume plugin for alpha provisioning
git clone https://github.com/kubernetes/charts
cd charts/stable/mariadb/templates
grep alpha pvc.yaml
  pvc.yaml:    volume.alpha.kubernetes.io/storage-class: default

[root@cloud4ourself-kcluster1 templates]# kubectl get storageclass
NAME      TYPE
fast      kubernetes.io/rbd
slow      kubernetes.io/rbd

修改為“”volume.beta.kubernetes.io/storage-class: slow“”
helm install stable/mariadb/

[root@cloud4ourself-kcluster1 ~]# kubectl get pvc
NAME                   STATUS    VOLUME                                     CAPACITY   ACCESSMODES   AGE
data-mysql-0           Bound     pvc-6c385d50-057a-11e7-9e49-fa163ef34ac6   10Gi       RWO           4d
data-mysql-1           Bound     pvc-6c3fa1a6-057a-11e7-9e49-fa163ef34ac6   10Gi       RWO           4d
data-mysql-2           Bound     pvc-6c472689-057a-11e7-9e49-fa163ef34ac6   10Gi       RWO           4d
hazy-heron-mariadb     Pending                                                                       5h
saucy-numbat-mariadb   Pending                                                                       6m
[root@cloud4ourself-kcluster1 ~]# kubectl describe pvc saucy-numbat-mariadb
Name:       saucy-numbat-mariadb
Namespace:  default
StorageClass:   slow
Status:     Pending
Volume:
Labels:     app=saucy-numbat-mariadb
        chart=mariadb-0.5.10
        heritage=Tiller
        release=saucy-numbat
Capacity:
Access Modes:
Events:
  FirstSeen LastSeen    Count   From                SubObjectPath   Type        Reason          Message
  --------- --------    -----   ----                -------------   --------    ------          -------
  5m        9s      21  {persistentvolume-controller }          Warning     ProvisioningFailed  Failed to provision volume with StorageClass "slow": rbd: create volume failed, err: executable file not found in $PATH

解決辦法參考屋彪,http://www.reibang.com/p/98337fc2e8d3

[root@cloud4ourself-kcluster1 ~]# kubectl get pvc
NAME                   STATUS    VOLUME                                     CAPACITY   ACCESSMODES   AGE

hazy-heron-mariadb     Pending                                                                       5h
saucy-numbat-mariadb   Pending                                                                       14m
xrayed-frog-mariadb    Pending                                                                       4m
[root@cloud4ourself-kcluster1 ~]# kubectl get pvc
NAME                   STATUS    VOLUME                                     CAPACITY   ACCESSMODES   AGE

hazy-heron-mariadb     Pending                                                                       5h
saucy-numbat-mariadb   Bound     pvc-1c8320c4-0958-11e7-8870-fa163ef34ac6   8Gi        RWO           14m
xrayed-frog-mariadb    Bound     pvc-86a3a3e6-0959-11e7-8870-fa163ef34ac6   8Gi        RWO           4m

[root@cloud4ourself-kcluster1 ~]# kubectl get pod
NAME                                                              READY     STATUS     RESTARTS   AGE
hazy-heron-mariadb-239282535-t501b                                0/1       Pending    0          5h

saucy-numbat-mariadb-958934623-vg6fk                              0/1       Init:0/1   0          15m

xrayed-frog-mariadb-3843238841-6x4m1                              0/1       Init:0/1   0          5m

[root@cloud4ourself-kcluster1 mariadb]# kubectl get pod
NAME                                                              READY     STATUS    RESTARTS   AGE
hazy-heron-mariadb-239282535-t501b                                0/1       Pending   0          5h

saucy-numbat-mariadb-958934623-vg6fk                              1/1       Running   0          19m

xrayed-frog-mariadb-3843238841-6x4m1                              0/1       Running   0          9m

#########################################

更新2017-08-21

install helm

http://www.reibang.com/p/1953b86649df

download helm

wget https://storage.googleapis.com/kubernetes-helm/helm-v2.6.0-linux-amd64.tar.gz
tar -xvf helm-v2.6.0-linux-amd64.tar.gz
sudo mv linux-amd64/helm /usr/local/bin/
rm -rf linux-amd64

create sa

kubectl create serviceaccount --namespace kube-system tiller
kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
kubectl patch deploy --namespace kube-system tiller-deploy -p '{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}'

run helm

helm init --service-account tiller --tiller-image 4admin2root/tiller:v2.6.0 --upgrade

check tiller in k8s

tiller-deploy-3864618634-gjqn7 1/1 Running 0 8m 10.32.0.60

? ~ helm version
Client: &version.Version{SemVer:"v2.6.0", GitCommit:"5bc7c619f85d74702e810a8325e0a24f729aa11a", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.6.0", GitCommit:"5bc7c619f85d74702e810a8325e0a24f729aa11a", GitTreeState:"clean"}

for example:

helm search jenkins
helm install --name my-release --set Persistence.StorageClass=slow stable/jenkins
helm get my-release
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末厦取,一起剝皮案震驚了整個濱河市,隨后出現(xiàn)的幾起案子碟绑,更是在濱河造成了極大的恐慌瑰抵,老刑警劉巖肛炮,帶你破解...
    沈念sama閱讀 212,080評論 6 493
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件蟀淮,死亡現(xiàn)場離奇詭異,居然都是意外死亡超凳,警方通過查閱死者的電腦和手機愈污,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 90,422評論 3 385
  • 文/潘曉璐 我一進店門耀态,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人暂雹,你說我怎么就攤上這事首装。” “怎么了擎析?”我有些...
    開封第一講書人閱讀 157,630評論 0 348
  • 文/不壞的土叔 我叫張陵簿盅,是天一觀的道長。 經(jīng)常有香客問我揍魂,道長桨醋,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 56,554評論 1 284
  • 正文 為了忘掉前任现斋,我火速辦了婚禮喜最,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘庄蹋。我一直安慰自己瞬内,他們只是感情好,可當我...
    茶點故事閱讀 65,662評論 6 386
  • 文/花漫 我一把揭開白布限书。 她就那樣靜靜地躺著虫蝶,像睡著了一般。 火紅的嫁衣襯著肌膚如雪倦西。 梳的紋絲不亂的頭發(fā)上能真,一...
    開封第一講書人閱讀 49,856評論 1 290
  • 那天,我揣著相機與錄音扰柠,去河邊找鬼粉铐。 笑死,一個胖子當著我的面吹牛卤档,可吹牛的內(nèi)容都是我干的蝙泼。 我是一名探鬼主播,決...
    沈念sama閱讀 39,014評論 3 408
  • 文/蒼蘭香墨 我猛地睜開眼劝枣,長吁一口氣:“原來是場噩夢啊……” “哼汤踏!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起舔腾,我...
    開封第一講書人閱讀 37,752評論 0 268
  • 序言:老撾萬榮一對情侶失蹤溪胶,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后琢唾,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體载荔,經(jīng)...
    沈念sama閱讀 44,212評論 1 303
  • 正文 獨居荒郊野嶺守林人離奇死亡盾饮,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 36,541評論 2 327
  • 正文 我和宋清朗相戀三年采桃,在試婚紗的時候發(fā)現(xiàn)自己被綠了懒熙。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 38,687評論 1 341
  • 序言:一個原本活蹦亂跳的男人離奇死亡普办,死狀恐怖工扎,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情衔蹲,我是刑警寧澤肢娘,帶...
    沈念sama閱讀 34,347評論 4 331
  • 正文 年R本政府宣布,位于F島的核電站舆驶,受9級特大地震影響橱健,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜沙廉,卻給世界環(huán)境...
    茶點故事閱讀 39,973評論 3 315
  • 文/蒙蒙 一拘荡、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧撬陵,春花似錦珊皿、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,777評論 0 21
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至草添,卻和暖如春驶兜,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背果元。 一陣腳步聲響...
    開封第一講書人閱讀 32,006評論 1 266
  • 我被黑心中介騙來泰國打工促王, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人而晒。 一個月前我還...
    沈念sama閱讀 46,406評論 2 360
  • 正文 我出身青樓蝇狼,卻偏偏與公主長得像,于是被迫代替她去往敵國和親倡怎。 傳聞我的和親對象是個殘疾皇子迅耘,可洞房花燭夜當晚...
    茶點故事閱讀 43,576評論 2 349

推薦閱讀更多精彩內(nèi)容