5
Grafana Tanka:比K8S YAML声明更简洁
source link: https://www.yp14.cn/2020/10/14/Grafana-Tanka%EF%BC%9A%E6%AF%94K8S-YAML%E5%A3%B0%E6%98%8E%E6%9B%B4%E7%AE%80%E6%B4%81/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Grafana Tanka
是 Kubernetes 集群的配置工具,由 Jsonnet
数据模板语言实现。
使用它比使用 Yaml
来定义 Kubernetes 资源更简洁
。Jsonnet
高度可重用,使你能通过组合现成的库来实现你的技术栈。
Grafana Tanka 亮点
干净
:使用Jsonet
语言表示你的Kubernetes应用,比YAML更简洁。可重用
:构建应用程序库,将它们导入任何地方,甚至在GitHub上共享它们!简洁
:使用Kubernetes库,不再需要模板。变化
:以轻松地知道确切的变化。生产环境Ready
:Tanka 部署了 Grafana Cloud 和更多生产设置。开源
:就像广受欢迎的Grafana
和Loki
项目一样,Tanka 是完全开源的。
K8S Yaml 与 Tanka 方式对比
K8S Yaml 声明
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
apiVersion: apps/v1
kind: Deployment
metadata:
name: grafana
spec:
selector:
matchLabels:
name: grafana
template:
metadata:
labels:
name: grafana
spec:
containers:
- image: grafana/grafana
name: grafana
ports:
- containerPort: 3000
name: ui
Tanka 方式声明
1
2
3
4
5
6
7
8
9
10
11
12
local k = import "k.libsonnet";
{
grafana: k.apps.v1.deployment.new(
name="grafana",
replicas=1,
containers=[k.core.v1.container.new(
name="grafana",
image="grafana/grafana",
)]
)
}
---本文结束感谢您的阅读。微信扫描二维码,关注我的公众号---
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK