[英]Minikube / Grafana : connection refused
I'm trying to install Grafana in a minikube local cluster with minikube 1.13.0
我正在尝试使用 minikube 1.13.0 在 minikube 本地集群中
minikube 1.13.0
Here is the whole process:这是整个过程:
minikube start # this step is OK
I deploy Grafana with:我使用以下命令部署 Grafana:
kubectl config use-context minikube
kubectl create namespace monitoring --dry-run=client -o yaml | kubectl apply -f -
kubectl create secret generic grafana-env --from-env-file=.env.local --namespace=monitoring --dry-run=client -o yaml | kubectl apply -f -
kubectl apply -f deployment/local/grafana-pvc.yml
kubectl apply -f deployment/local/grafana-secret.yml
kubectl apply -f deployment/local/grafana-deployment.yml
kubectl apply -f deployment/local/grafana-svc.yml
kubectl apply -f deployment/local/grafana-ingress-local.yml
Deployment:部署:
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
reloader.stakater.com/auto: "true"
name: grafana-core-local
namespace: monitoring
labels:
app: grafana-local
component: core
spec:
selector:
matchLabels:
app: grafana-local
replicas: 1
template:
metadata:
labels:
app: grafana-local
component: core
spec:
dnsConfig:
options:
- name: ndots
value: "0"
initContainers:
- name: init-chown-data
image: grafana/grafana:7.0.0
imagePullPolicy: IfNotPresent
securityContext:
runAsUser: 0
command: ["chown", "-R", "472:472", "/var/lib/grafana"]
volumeMounts:
- name: grafana-persistent-storage
mountPath: /var/lib/grafana
containers:
- image: grafana/grafana:7.0.0
name: grafana-core-local
imagePullPolicy: IfNotPresent
securityContext:
runAsUser: 472
# env:
resources:
# keep request = limit to keep this container in guaranteed class
limits:
cpu: 100m
memory: 100Mi
requests:
cpu: 100m
memory: 100Mi
envFrom:
- secretRef:
name: grafana-env
env:
# The following env variables set up basic auth twith the default admin user and admin password.
- name: GF_AUTH_BASIC_ENABLED
value: "true"
- name: GF_SECURITY_ADMIN_USER
valueFrom:
secretKeyRef:
name: grafana
key: admin-username
- name: GF_SECURITY_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
name: grafana
key: admin-password
- name: GF_AUTH_ANONYMOUS_ENABLED
value: "false"
- name: GF_SERVER_ROOT_URL
value: "http://grafana.local"
readinessProbe:
httpGet:
path: /login
port: 3000
volumeMounts:
- name: grafana-persistent-storage
mountPath: /var/lib/grafana
- name: grafana-datasources
mountPath: /etc/grafana/provisioning/datasources
volumes:
- name: grafana-persistent-storage
persistentVolumeClaim:
claimName: grafana-storage
- name: grafana-datasources
configMap:
name: grafana-datasources
Service :服务 :
apiVersion: v1
kind: Service
metadata:
name: grafana-local
namespace: monitoring
labels:
app: grafana-local
component: core
spec:
type: NodePort
ports:
- port: 3000
selector:
app: grafana-local
component: core
And Ingress:和入口:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: grafana-ingress
namespace: monitoring
annotations:
kubernetes.io/ingress.class: traefik
spec:
rules:
- host: grafana.local
http:
paths:
- backend:
serviceName: grafana-local
servicePort: 3000
I also added a grafana.local entry in /etc/hosts
to link it to 127.0.0.1
我还在
/etc/hosts
添加了一个 grafana.local 条目以将其链接到127.0.0.1
Pod, service, and ingress are deployed successfully, I see no errors. Pod、service、ingress都部署成功了,没看到错误。
But when I try to access it through chrome, I get a ERR_CONNECTION_REFUSED
error.但是当我尝试通过 chrome 访问它时,我收到一个
ERR_CONNECTION_REFUSED
错误。
It is important to say that before, I was starting minikube with the none driver, and it was working well:重要的是要说之前,我使用 none 驱动程序启动 minikube,并且运行良好:
sudo minikube start --vm-driver none
Also, when I do:另外,当我这样做时:
minikube dashboard
I can access the dashboard with no problem.我可以毫无问题地访问仪表板。
What am my missing ?我缺少什么?
Just run kubectl port-forward
in a separate terminal:只需在单独的终端中运行
kubectl port-forward
:
kubectl -n monitoring port-forward svc/grafana-local 3000
Then you would be able to access Grafana on http://127.0.0.1:3000 .然后你就可以在http://127.0.0.1:3000上访问 Grafana。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.