标签:基本 tanka name grafana prometheus 试用 spec metadata
以下是tanka的参考试用
依赖
- kubectl
- diff
- jb jsonnet bundler
- helm
安装tanka
mac os
- 命令
brew install tanka
brew install jsonnet-bundler
试用
- 创建项目
mkdir prom-grafana && cd prom-grafana
tk init
效果
需要等待下载
目录结构
- 添加资源
main.jsonnet
{
// Grafana
grafana: {
deployment: {
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',
}],
},
],
},
},
},
},
service: {
apiVersion: 'v1',
kind: 'Service',
metadata: {
labels: {
name: 'grafana',
},
name: 'grafana',
},
spec: {
ports: [{
name: 'grafana-ui',
port: 3000,
targetPort: 3000,
}],
selector: {
name: 'grafana',
},
type: 'NodePort',
},
},
},
// Prometheus
prometheus: {
deployment: {
apiVersion: 'apps/v1',
kind: 'Deployment',
metadata: {
name: 'prometheus',
},
spec: {
minReadySeconds: 10,
replicas: 1,
revisionHistoryLimit: 10,
selector: {
matchLabels: {
name: 'prometheus',
},
},
template: {
metadata: {
labels: {
name: 'prometheus',
},
},
spec: {
containers: [
{
image: 'prom/prometheus',
imagePullPolicy: 'IfNotPresent',
name: 'prometheus',
ports: [
{
containerPort: 9090,
name: 'api',
},
],
},
],
},
},
},
},
service: {
apiVersion: 'v1',
kind: 'Service',
metadata: {
labels: {
name: 'prometheus',
},
name: 'prometheus',
},
spec: {
ports: [
{
name: 'prometheus-api',
port: 9090,
targetPort: 9090,
},
],
selector: {
name: 'prometheus',
},
},
},
},
}
- 查看生成的资源
tk show environments/default
效果:
- 配置k8s 部署
spec.json
{
"apiVersion": "tanka.dev/v1alpha1",
"kind": "Environment",
"metadata": {
"name": "default"
},
"spec": {
"apiServer": "https://127.0.0.1:6443", // cluster to use
"namespace": "monitoring" // default namespace for all created resources
}
}
- 部署
tk apply environments/default
tk 支持的命令
- 参考命令
tanka <3 jsonnet
Usage:
tk [command]
Available Commands:
apply apply the configuration to the cluster
show jsonnet as yaml
diff differences between the configuration and the cluster
prune delete resources removed from Jsonnet
delete delete the environment from cluster
env manipulate environments
status display an overview of the environment, including contents and metadata.
export write each resources as a YAML file
fmt format Jsonnet code
eval evaluate the jsonnet to json
init Create the directory structure
tool handy utilities for working with jsonnet
complete install CLI completions
参考资料
标签:基本,tanka,name,grafana,prometheus,试用,spec,metadata 来源: https://www.cnblogs.com/rongfengliang/p/13974920.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。