0%

Kubernetes-helm

阅读更多

1 helm语法

  1. 内建对象

2 Tips

2.1 仅下载chart package

1
helm pull --destination /path/to/save/my-chart-1.0.0.tgz <repository-url>/<chart-name>

2.2 仅渲染chart package

1
helm template <chart-directory>

2.3 从运行时提取信息,并注入到环境变量中

1
2
3
4
5
6
containers:
- env:
- name: NODE_IP
valueFrom:
fieldRef:
fieldPath: status.hostIP

2.4 环境变量相互引用

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
containers:
env:
- name: DB_URL_HOSTNAME // part 1
valueFrom:
secretKeyRef:
name: my-database-credentials
key: hostname

- name: DB_URL_PORT // part 2
valueFrom:
secretKeyRef:
name: my-database-credentials
key: port

- name: DB_URL_DBNAME // part 3
valueFrom:
secretKeyRef:
name: my-database-credentials
key: database

- name: DATABASE_URL // combine
value: jdbc:postgresql:$(DB_URL_HOSTNAME):$(DB_URL_PORT)/$(DB_URL_DBNAME)

3 参考