赞
踩
目录
1、安装nfs-subdir-external-provisioner
5、安装Grafana grafana.yaml kubectl apply -f grafana.yaml(参照官网)
8、创建Grafana Dashboard,选择import,效果如下
helm install nfs-subdir-external-provisioner nfs-subdir-external-provisioner/nfs-subdir-external-provisioner -f values.yaml -n default
docker pull k8s.gcr.io/sig-storage/nfs-subdir-external-provisioner:v4.0.2
下载地址nfs-subdir-external-provisioner安装文件资源-CSDN文库
helm repo add apisix https://charts.apiseven.com
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo updatehelm install apisix apisix/apisix \
--set ingress-controller.enabled=true \
--set dashboard.enabled=true \
--set gateway.tls.enabled=true \
--set etcd.volumePermissions.enabled=true \
--set etcd.persistence.storageClass="nfs-client" \
--set etcd.persistence.size="22Gi" \
--set ingress-controller.config.apisix.adminKey="edd1c9f034335f136f87ad84b625c8f1" \
--set admin.credentials.admin="edd1c9f034335f136f87ad84b625c8f1" \
--set admin.credentials.viewer="4054f7cf07e344346cd3f287985e76a2" \
--set ingress-controller.config.apisix.serviceNamespace=apisix --namespace apisix --create-namespace安装完成,查看网关的打印地址
export NODE_PORT=$(kubectl get --namespace apisix -o jsonpath="{.spec.ports[0].nodePort}" services apisix-gateway)
export NODE_IP=$(kubectl get nodes --namespace apisix -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
使用第二步安装的apisix service 端口未暴露,需要修改暴露出来
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: apisix
namespace: apisix
spec:
endpoints:
- scheme: http
targetPort: monitor
path: /apisix/prometheus/metrics
interval: 15s
namespaceSelector:
matchNames:
- apisix
selector:
matchLabels:
app.kubernetes.io/name: apisix
app.kubernetes.io/version: 3.3.0
helm.sh/chart: apisix-2.0.0
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: grafana-pvc
namespace: apisix
spec:
storageClassName: nfs-client
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: grafana
name: grafana
namespace: apisix
spec:
selector:
matchLabels:
app: grafana
template:
metadata:
labels:
app: grafana
spec:
securityContext:
fsGroup: 472
supplementalGroups:
- 0
containers:
- name: grafana
image: grafana/grafana:9.1.0
imagePullPolicy: IfNotPresent
ports:
- containerPort: 3000
name: http-grafana
protocol: TCP
readinessProbe:
failureThreshold: 3
httpGet:
path: /robots.txt
port: 3000
scheme: HTTP
initialDelaySeconds: 10
periodSeconds: 30
successThreshold: 1
timeoutSeconds: 2
livenessProbe:
failureThreshold: 3
initialDelaySeconds: 30
periodSeconds: 10
successThreshold: 1
tcpSocket:
port: 3000
timeoutSeconds: 1
resources:
requests:
cpu: 250m
memory: 750Mi
volumeMounts:
- mountPath: /var/lib/grafana
name: grafana-pv
volumes:
- name: grafana-pv
persistentVolumeClaim:
claimName: grafana-pvc
---
apiVersion: v1
kind: Service
metadata:
name: grafana
namespace: apisix
spec:
ports:
- port: 3000
protocol: TCP
targetPort: http-grafana
selector:
app: grafana
sessionAffinity: None
type: LoadBalancer
prometheus获取apisix的信息可能会初选拒绝连接的情况,默认apisix暴露的地址是本地的,需要修改下配置
正常情况,看到信息应该如下图
地址是:http://prometheus-operated.kubesphere-monitoring-system.svc:9090
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。