通过Fluentd将Kubernetes的日志发送到Cloudwatch

时间:2019-06-04 10:06:14

标签: amazon-ec2 kubernetes amazon-cloudwatch fluentd

我正在尝试通过Kubernetes和AWS来了解云基础知识

我在这里的尝试是将日志从我的容器发送到云监视。 应用程序(带有celery beat的Django示例):

我的豆荚:

NAMESPACE     NAME                                                                  READY   STATUS             RESTARTS   AGE
default       celery-beat-76dfdcc9d8-hrkzv                                          1/1     Running            0          93m
default       celery-worker-6f4d9f4985-66jfh                                        1/1     Running            0          93m
default       django-6db9754bd6-hnm84                                               1/1     Running            0          93m
default       django-migrations-9nb85                                               0/1     Completed          0          93m
default       flower-b977fcbd5-mdjrp                                                0/1     CrashLoopBackOff   22         93m
default       redis-fd65865fc-mfbwt                                                 1/1     Running            0          93m
kube-system   dns-controller-64b775df4d-trkvf                                       1/1     Running            1          9h
kube-system   etcd-manager-events-ip-172-20-45-193.us-west-1.compute.internal       1/1     Running            1          9h
kube-system   etcd-manager-main-ip-172-20-45-193.us-west-1.compute.internal         1/1     Running            1          9h
kube-system   kube-apiserver-ip-172-20-45-193.us-west-1.compute.internal            1/1     Running            3          9h
kube-system   kube-controller-manager-ip-172-20-45-193.us-west-1.compute.internal   1/1     Running            1          9h
kube-system   kube-dns-57dd96bb49-v6vqs                                             3/3     Running            3          9h
kube-system   kube-dns-57dd96bb49-vfrx9                                             3/3     Running            3          9h
kube-system   kube-dns-autoscaler-867b9fd49d-pg9j5                                  1/1     Running            1          9h
kube-system   kube-proxy-ip-172-20-45-193.us-west-1.compute.internal                1/1     Running            1          9h
kube-system   kube-proxy-ip-172-20-47-25.us-west-1.compute.internal                 1/1     Running            1          9h
kube-system   kube-proxy-ip-172-20-93-150.us-west-1.compute.internal                1/1     Running            1          9h
kube-system   kube-scheduler-ip-172-20-45-193.us-west-1.compute.internal            1/1     Running            1          9h
kube-system   kubernetes-dashboard-65c76f6c97-sdgjg                                 1/1     Running            1          9h
kube-system   tiller-deploy-58d57fd669-bzgfl                                        1/1     Running            1          9h

我能够使用kubernetes仪表板访问我的应用程序集群。在Pod下的部分-Logs可以查看Pod日志。

enter image description here

现在我正尝试将这些日志发送到AWS CLoudwatch,然后流式传输到AWS ELasticSearch

以下情侣

创建了命名空间日志记录

 **kubectl create namespace logging**
> helm init

我的values.yaml

image:
  repository: fluent/fluentd-kubernetes-daemonset
  tag: v0.12.33-cloudwatch
## Specify an imagePullPolicy (Required)
## It's recommended to change this to 'Always' if the image tag is 'latest'
## ref: http://kubernetes.io/docs/user-guide/images/#updating-images
  pullPolicy: IfNotPresent

## Configure resource requests and limits
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
##
resources:
  limits:
    cpu: 100m
    memory: 200Mi
  requests:
    cpu: 100m
    memory: 200Mi

# hostNetwork: false

## Add tolerations if specified
tolerations: []
#   - key: node-role.kubernetes.io/master
#     operator: Exists
#     effect: NoSchedule

annotations: {}

awsRegion: us-west-1
awsRole:
logGroupName: logging

应用更改(以root身份运行)

helm install --name fluentd -f ./values.yaml incubator / fluentd-cloudwatch --namespace日志记录

执行后,流畅的报告CrashLoopBackOff

  

记录fluentd-fluentd-cloudwatch-b9dlb
  0/1 CrashLoopBackOff 1 16s记录
  fluentd-fluentd-cloudwatch-jm229
  0/1 CrashLoopBackOff 1 16秒

日志

kubectl logs fluentd-fluentd-cloudwatch-b9dlb --namespace logging

standard_init_linux.go:190:exec用户进程导致“没有此类文件或目录”

请求一些指导

0 个答案:

没有答案