k8s部署grafana

news/2024/9/23 7:51:30/

修改grafana-pvc.yaml文件中的信息,然后应用YAML文件

cat > /opt/k8s/grafana/grafana-pvc.yaml <<EOF
apiVersion: v1
kind: PersistentVolumeClaim
metadata:name: grafana-data-pvc
spec:accessModes:- ReadWriteManystorageClassName: "nfs-storage"resources:requests:storage: 5Gi
EOF
kubectl apply -f grafana-pvc.yaml 
kubectl get pvc

部署ConfigMap

上传文件grafana.ini 到/opt/k8s/grafana/file/下

kubectl create configmap grafana-config \--from-file=grafana.yml=/opt/k8s/grafana/file/grafana.ini

如需修改可使用kubectl edit 或者以下方式

删除现有的ConfigMap

kubectl delete configmap grafana-config

使用新的文件重新创建ConfigMap

kubectl create configmap grafana-config
–from-file=grafana.yml=/opt/k8s/grafana/file/grafana.ini

部署Deployment

修改grafana-Deployment.yaml文件中的信息,然后应用YAML文件

cat > /opt/k8s/grafana/grafana-Deployment.yaml <<EOF
apiVersion: apps/v1
kind: Deployment
metadata:name: grafana
spec:replicas: 1selector:matchLabels:app: grafanatemplate:metadata:labels:app: grafanaspec:containers:- name: grafanaimage: grafana/grafanaports:- containerPort: 3000env:- name: GF_SECURITY_ADMIN_USERvalue: "admin"- name: GF_SECURITY_ADMIN_PASSWORDvalue: "admin"volumeMounts:- name: grafana-storagemountPath: /var/lib/grafana- name: grafana-configmountPath: /etc/grafana/grafana.inisubPath: grafana.inivolumes:- name: grafana-storagepersistentVolumeClaim:claimName: grafana-data-pvc- name: grafana-configconfigMap:name: grafana-config
EOF
kubectl apply -f grafana-Deployment.yaml 
kubectl get Deployment

部署Service

修改grafana-Service.yaml文件中的信息,然后应用YAML文件

cat > /opt/k8s/grafana/grafana-Service.yaml <<EOF
apiVersion: v1
kind: Service
metadata:name: grafana-service
spec:type: NodePortports:- port: 3000targetPort: 3000nodePort: 30000selector:app: grafana
EOF
kubectl apply -f grafana-Service.yaml 
kubectl get Service

http://www.ppmy.cn/news/1444570.html

相关文章

selenium 4.x入门篇(环境搭建、八大元素定位)

背景 Web自动化测现状 1. 属于 E2E 测试 2. 过去通过点点点 3. 好的测试&#xff0c;还需要记录、调试网页的细节 一、selenium4.x环境搭建 一键搭建 pip3 install webdriver-helper 安装后自动的完成&#xff1a; 1. 查看浏览器的版本号 2. 查询操作系统的类型…

纯血鸿蒙APP实战开发——全局状态保留能力弹窗

全局状态保留能力弹窗 介绍 全局状态保留能力弹窗一种很常见的能力&#xff0c;能够保持状态&#xff0c;且支持全局控制显隐状态以及自定义布局。使用效果参考评论组件 效果图预览 使用说明 使用案例参考短视频案例 首先程序入口页对全局弹窗初始化&#xff0c;使用Globa…

分布式事务Seata<XA模式、AT模式>解决方案思路(针对多数据源、分库分表、微服务、微服务分库分表4种场景)

seata的xa的方式解决 保证强一致性 原理说明&#xff1a; 1.启动seata服务器TC&#xff08;控制台7091可以查看&#xff09; 2.启动spring项目 初始化TM RM&#xff0c;实际上TM和RM注册到TC中 3.浏览器访问执行方法&#xff0c;TM向TC请求开启全局事务&#xff0c; 返回一个全…

redis中使用pipeline批量执行命令,提升性能

注意&#xff1a;此操作非原子性 将一批要执行的redis命令提交到pipeline中&#xff0c;pipeline一次性的将数据发送给服务器&#xff0c;服务器再逐条执行命令。 redisTemplate中已经提供了对应方法executePipelined()可以直接调用&#xff0c;它支持两个类型…

极客蒂姆·斯威尼:用虚幻引擎,修补真实世界(下) | 人物志048

斯威尼创办了EPIC公司&#xff0c;并发行了自己的游戏ZZT。那一年&#xff0c;他21岁。斯威尼说&#xff0c;21岁是个“更容易满足”的年纪&#xff0c;那个时候&#xff0c;每天的三四个订单已经足够令他欣喜若狂。“每天能赚大约100美元。在当时&#xff0c;这真不是一笔小钱…

安卓手机APP开发__媒体开发部分__APK裁剪

安卓手机APP开发__媒体开发部分__APK裁剪 目录 概述 仅使用必要的依赖 启用代码和资源的裁剪 指定你的APP需要哪一个渲染器 指定你的APP需要哪个抽取器 定制媒体源的实例化 概述 最小化APK的大小是开发一个好的安卓APP的一个重要的方面.当面向的是正在开发 的市场时更是…

Apollo 7周年大会:百度智能驾驶的展望与未来

本心、输入输出、结果 文章目录 Apollo 7周年大会&#xff1a;百度智能驾驶的展望与未来前言百度集团副总裁、智能驾驶事业群组总裁王云鹏发言 直播回放大会相关内容先了解 Apollo&#xfeff;开放平台 9.0架构图 发布产品Apollo 定义自己对于智能化的认知百度集团副总裁 王云鹏…

【Pytorch】NameError: name ‘Variable‘ is not defined

报错 NameError Traceback (most recent call last) Cell In[20], line 42 for epoch in range(num_epochs):3 if torch.cuda.is_available(): ----> 4 inputs Variable(x_train).cuda()5 target Variable(y_train).…