赞
踩
如何管理,编辑和更新这些这些分散的Kubernetes应用配置文件?
如何把一套的相关配置文件作为一个应用进行管理?
如何分发和重用Kubernetes的应用配置?
Helm组件及相关术语
下载 Helm https://github.com/kubernetes/helm/releases
解压 tar -zxvf helm-v2.0.0-linux-amd64.tgz
拷贝到bin目录 mv linux-amd64/helm /usr/local/bin/helm
Helm init
git clone https://github.com/zhaohuabing/testapi.git; cd testapi
helm create testapi-chart
testapi-chart├── charts├── Chart.yaml├── templates│ ├── deployment.yaml│ ├── _helpers.tpl│ ├── NOTES.txt│ └── service.yaml└── values.yaml
Chart.yaml用于描述这个Chart,包括名字、描述信息以及版本。
values.yaml 用于存储templates目录中模板文件中用到的变量。 模板文件一般是Go模板。如果你需要了解更多关于Go模板的相关信息,可以查看Hugo[1]的一个关于Go模板的介绍[2]。
NOTES.txt用于向部署该Chart的用于介绍Chart部署后的一些信息。例如介绍如何使用这个Chart,列出缺省的设置等。
apiVersion: v1description: A simple api for testing and debuggingname: testapi-chartversion: 0.0.1
replicaCount: 2image: repository: daemonza/testapi tag: latest pullPolicy: IfNotPresentservice: name: testapi type: ClusterIP externalPort: 80 internalPort: 80resources: limits: cpu: 100m memory: 128Mi requests: cpu: 100m memory: 128Mi
helm lint==> Linting .[INFO] Chart.yaml: icon is recommended1 chart(s) linted, no failures
helm package testapi-chart --debug
Saved /Users/daemonza/testapi/testapi-chart/testapi-chart-0.0.1.tgz to current directorySaved /Users/daemonza/testapi/testapi-chart/testapi-chart-0.0.1.tgz to /Users/daemonza/.helm/repository/local
helm search testapiNo results found
helm repo listNAME URLstable https://kubernetes-charts.storage.googleapis.com
helm serve&Now serving you on 127.0.0.1:8879
helm repo add local http://127.0.0.1:8879"local" has been added to your repositories
helm search testapiNAME CHART VERSION APP VERSION DESCRIPTIONlocal/testapi-chart 0.0.1 A Helm chart for Kubernetes
helm install local/testapi-chart --name testapi
NAME: testapiLAST DEPLOYED: Mon Apr 16 10:21:44 2018NAMESPACE: defaultSTATUS: DEPLOYEDRESOURCES:==> v1/ServiceNAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGEtestapi-testapi-chart ClusterIP 10.43.121.84 <none> 80/TCP 0s==> v1beta1/DeploymentNAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGEtestapi-testapi-chart 1 1 1 0 0s==> v1/Pod(related)NAME READY STATUS RESTARTS AGEtestapi-testapi-chart-9897d9f8c-nn6wd 0/1 Pending 0 0sNOTES:1. Get the application URL by running these commands: export POD_NAME=$(kubectl get pods --namespace default -l "app=testapi-testapi-chart" -o jsonpath="{.items[0].metadata.name}") echo "Visit http://127.0.0.1:8080 to use your application" kubectl port-forward $POD_NAME 8080:80
helm ls
NAME REVISION UPDATED STATUS CHART NAMESPACEtestapi 1 Mon Apr 16 10:21:44 2018 DEPLOYED testapi-chart-0.0.1 default
helm search testapi -lNAME CHART VERSION APP VERSION DESCRIPTIONlocal/testapi-chart 0.0.1 A Helm chart for Kuberneteslocal/testapi-chart 1.0.0 A Helm chart for Kubernetes
helm upgrade testapi local/testapi-chart
helm listNAME REVISION UPDATED STATUS CHART NAMESPACEtestapi 2 Mon Apr 16 10:43:10 2018 DEPLOYED testapi-chart-1.0.0 default
helm history testapiREVISION UPDATED STATUS CHART DESCRIPTION1 Mon Apr 16 10:21:44 2018 SUPERSEDED testapi-chart-0.0.1 Install complete2 Mon Apr 16 10:43:10 2018 DEPLOYED testapi-chart-1.0.0 Upgrade complete
helm rollback testapi 1
helm list
NAME REVISION UPDATED STATUS CHART NAMESPACE
testapi 3 Mon Apr 16 10:48:20 2018 DEPLOYED testapi-chart-0.0.1 default
dependencies: - name: apache version: 1.2.3 repository: http://example.com/charts - name: mysql version: 3.2.1 repository: http://another.example.com/charts
https://gohugo.io
https://gohugo.io/templates/go-templates/
Kubernetes入门与进阶实战培训
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。