我正在尝试使用minikube 1.13.0
这是整个过程:
minikube start # this step is OK
我通过以下方式部署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
部署:
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
服务:
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
入口:
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
我还在/etc/hosts
中添加了grafana.local条目以将其链接到127.0.0.1
Pod,服务和入口已成功部署,我看不到任何错误。
但是当我尝试通过chrome访问它时,出现了ERR_CONNECTION_REFUSED
错误。
很重要的一点是,以前,我是使用none驱动程序启动minikube的,并且运行良好:
sudo minikube start --vm-driver none
此外,当我这样做时:
minikube dashboard
我可以正常访问仪表板。
我想念什么?