k8s部署kibana
时间: 2023-12-12 14:36:11 浏览: 93
kibana sample自己搭建k8s测试数据
在Kubernetes上部署Kibana的步骤如下:
1.创建Kibana的deployment和service:
```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: kibana
spec:
replicas: 1
selector:
matchLabels:
app: kibana
template:
metadata:
labels:
app: kibana
spec:
containers:
- name: kibana
image: docker.elastic.co/kibana/kibana:7.14.0
ports:
- containerPort: 5601
env:
- name: ELASTICSEARCH_URL
value: http://elasticsearch:9200
---
apiVersion: v1
kind: Service
metadata:
name: kibana
spec:
selector:
app: kibana
ports:
- name: http
port: 5601
targetPort: 5601
```
2.创建Kibana的Ingress:
```yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: kibana
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
rules:
- host: kibana.example.com
http:
paths:
- path: /kibana(/|$)(.*)
pathType: Prefix
backend:
service:
name: kibana
port:
name: http
```
3.将Kibana的Ingress暴露到外部:
```shell
kubectl apply -f kibana-ingress.yaml
```
现在,您可以通过访问http://kibana.example.com/kibana来访问Kibana。
阅读全文