EFK 日志系统的部署和使用
安装 ElasticSearch
helm repo add elastic https://helm.elastic.co
cat > els-values.yaml << EOF
clusterName: "elasticsearch"
replicas: 2
minimumMasterNodes: 1
image: "docker.elastic.co/elasticsearch/elasticsearch"
imageTag: "7.17.3"
imagePullPolicy: "IfNotPresent"
resources:
requests:
cpu: "500m"
memory: "1Gi"
limits:
cpu: "1000m"
memory: "2Gi"
persistence:
enabled: false
labels:
# Add default labels for the volumeClaimTemplate of the StatefulSet
enabled: false
annotations: {}
EOF
helm install els elastic/elasticsearch -f els-values.yaml --create-namespace --namespace logging --version=7.17.3
安装 Kibana
cat > kibana-values.yaml << EOF
elasticsearchHosts: "http://elasticsearch-master:9200"
image: "docker.elastic.co/kibana/kibana"
imageTag: "7.17.3"
imagePullPolicy: "IfNotPresent"
resources:
requests:
cpu: "500m"
memory: "1Gi"
limits:
cpu: "1000m"
memory: "2Gi"
service:
type: NodePort
loadBalancerIP: ""
port: 5601
nodePort: ""
labels: {}
annotations:
{}
# cloud.google.com/load-balancer-type: "Internal"
# service.beta.kubernetes.io/aws-load-balancer-internal: 0.0.0.0/0
# service.beta.kubernetes.io/azure-load-balancer-internal: "true"
# service.beta.kubernetes.io/openstack-internal-load-balancer: "true"
# service.beta.kubernetes.io/cce-load-balancer-internal-vpc: "true"
loadBalancerSourceRanges:
[]
# 0.0.0.0/0
httpPortName: http
ingress:
enabled: true
className: "nginx"
hosts:
- host: kibana.local
paths:
- path: /
EOF
helm install kibana elastic/kibana -f kibana-values.yaml -n logging --create-namespace --version=7.17.3
安装 Filebeat
cat > filebeat-values.yaml << 'EOF'
daemonset:
enabled: true
filebeatConfig:
filebeat.yml: |
filebeat.inputs:
- type: container
paths:
- /var/log/containers/*.log
processors:
- add_kubernetes_metadata:
host: ${NODE_NAME}
matchers:
- logs_path:
logs_path: "/var/log/containers/"
output.elasticsearch:
host: '${NODE_NAME}'
hosts: '${ELASTICSEARCH_HOSTS:elasticsearch-master:9200}'
resources:
requests:
cpu: "200m"
memory: "200Mi"
limits:
cpu: "1000m"
memory: "2000Mi"
image: "docker.elastic.co/beats/filebeat"
imageTag: "7.15.1"
imagePullPolicy: "IfNotPresent"
imagePullSecrets: []
EOF
helm install filebeat elastic/filebeat -f filebeat-values.yaml -n logging --create-namespace --version=7.17.3
访问 Kibana
打开 Kibana 网页 http://kibana.local
浙公网安备 33010602011771号