Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Kubernetes Istio混合器容器日志导致磁盘空间使用率高_Kubernetes_Istio - Fatal编程技术网

Kubernetes Istio混合器容器日志导致磁盘空间使用率高

Kubernetes Istio混合器容器日志导致磁盘空间使用率高,kubernetes,istio,Kubernetes,Istio,我有一个支持Istio的EKS集群,我的节点不断地耗尽磁盘空间 计算总体磁盘使用率会导致我找到istio mixer容器,该容器有一个日志文件,仅在12天的正常运行时间内使用了超过50GB的磁盘空间: [root@ip-some-ip containers]# pwd /var/lib/docker/containers [root@ip-some-ip containers]# du -schx .[!.]* * | sort -h | tail -n 10 66M 8bf5e8ee5a03

我有一个支持Istio的EKS集群,我的节点不断地耗尽磁盘空间

计算总体磁盘使用率会导致我找到istio mixer容器,该容器有一个日志文件,仅在12天的正常运行时间内使用了超过50GB的磁盘空间:

[root@ip-some-ip containers]# pwd
/var/lib/docker/containers

[root@ip-some-ip containers]# du -schx .[!.]* * | sort -h | tail -n 10
66M 8bf5e8ee5a03096c589ad8f53b9e1a3d3088ca67b0064f3796e406f00336b532
73M 657eca261461d10c5b1b81ab3078d2058b931a357395903808b0145b617c1662
101M    bb338296ff06ef42ae6177c8a88e63438c26c398a457dc3f5301ffcb4ef2682b
127M    21f2da86055ad76882730abf65d4465386bb85598f797f451e7ad66726243613
134M    9c2be24e8b9345659b6f208c9f2d4650bb1ece11e0c4b0793aa01fdfebadb44e
383M    5d5fdbe6813ddc3ff2f6eb96f62f8317bd73e24730e2f44ebc537367d9987142
419M    475f8dfc74c3df2bc95c47df56e37d1dfb9181fae9aa783dafabba8283023115
592M    9193c50e586e0c7ecaeb87cecd8be13714a5d6ccd6ea63557c034ef56b07772f
52G 9c6b3e4f26603471d0aa9b6a61b3da5a69001e6b9be34432ffa62d577738c149
54G total

[root@ip-192-168-228-194 containers]# du -hs 9c6b3e4*/*.log
52G 9c6b3e4f26603471d0aa9b6a61b3da5a69001e6b9be34432ffa62d577738c149-json.log

[root@ip-ip-some-ip containers]# docker ps -a | grep 9c6b3e4f2660
9c6b3e4f2660        d559bdcd7a88                                                       "/usr/local/bin/mi..."   12 days ago         Up 12 days                                     k8s_mixer_istio-telemetry-6b5579595f-fvm5x_istio-system_6324c262-f3b5-11e8-b615-0eccb0bb4724_0
我的问题是:

  • 预期的日志输出量是多少
  • 混音器日志级别可以降低吗?怎么用?更改它会影响我的遥测指标吗
  • 有没有办法配置日志“保留期”
其他信息:

  • Istio v1.0.2(与官方舵图一起部署;无自定义配置)
  • k8s v1.10.11-eks
  • 集群大约有20个POD运行在支持Istio的名称空间中

混音器中记录级别的默认值为info。以及您提供的日志,确认您具有此设置。因此,在日志中收集了大量冗余信息,因此有可能降低某些源的日志级别

您可以通过两种方式进行更改:

  • 在不重新启动的情况下打开工作舱。

    在日志中,您可以找到以下行:

    2018-12-12T17:54:55.461261Z info    ControlZ available at 192.168.87.249:9876
    
    这意味着,在9876端口的混合器容器中,您可以找到Istio ControlZ web界面。要从安装了
    kubectl
    的计算机访问它,您需要运行以下命令:

    kubectl -n istio-system port-forward $(kubectl -n istio-system get pod -l istio=mixer,istio-mixer-type=telemetry -o jsonpath='{.items[0].metadata.name}') 9876:9876 &
    
    之后,在浏览器中转到链接,您将看到以下仪表板,您可以在其中更改日志级别:

  • 混合器
    容器的
    istio遥测
    部署添加
    --log\u output\u level
    标志。

    以下是混音器文档中的标志说明:

    --日志输出级别字符串
    要输出的消息的每个作用域日志记录级别的最小逗号分隔值,格式为:,:,。。。其中范围可以是[adapters,api,attributes,default,grpcAdapter,LoadShell]中的一个,级别可以是[debug,info,warn,error,none]中的一个(默认值为“default:info”)

    注意,对于yaml文件中的key
    --log\u output\u level属性:warn、api:error
    ,您需要使用以下选项之一:

    • --log\u output\u level=属性:警告、api:error
    • 值<代码>---日志\u输出\u级别和<代码>-属性:警告,api:错误,在不同的行上
    部署的示例如下:

    apiVersion: extensions/v1beta1
    kind: Deployment
    metadata:
      annotations:
      labels:
        chart: mixer-1.0.4
        istio: mixer
        release: istio
      name: istio-telemetry
      namespace: istio-system
    spec:
      progressDeadlineSeconds: 600
      replicas: 2
      revisionHistoryLimit: 10
      selector:
        matchLabels:
          app: telemetry
          istio: mixer
          istio-mixer-type: telemetry
      strategy:
        rollingUpdate:
          maxSurge: 1
          maxUnavailable: 1
        type: RollingUpdate
      template:
        metadata:
          annotations:
            scheduler.alpha.kubernetes.io/critical-pod: ""
            sidecar.istio.io/inject: "false"
          creationTimestamp: null
          labels:
            app: telemetry
            istio: mixer
            istio-mixer-type: telemetry
        spec:
          containers:
          - args:                                                #Flags for the Mixer process
            - --address                                          #Flag on two different lines
            - unix:///sock/mixer.socket
            - --configStoreURL=k8s://                            #Flag with '='
            - --configDefaultNamespace=istio-system
            - --trace_zipkin_url=http://zipkin:9411/api/v1/spans
            - --log_output_level=attributes:warn,api:error       # <------ THIS LINE IS WHAT YOU ARE LOOKING FOR
            env:
            - name: GODEBUG
              value: gctrace=2
            image: docker.io/istio/mixer:1.0.4
            imagePullPolicy: IfNotPresent
            livenessProbe:
              failureThreshold: 3
              httpGet:
                path: /version
                port: 9093
                scheme: HTTP
              initialDelaySeconds: 5
              periodSeconds: 5
              successThreshold: 1
              timeoutSeconds: 1
            name: mixer
            ports:
            - containerPort: 9093
              protocol: TCP
            - containerPort: 42422
              protocol: TCP
            resources:
              requests:
                cpu: 10m
            terminationMessagePath: /dev/termination-log
            terminationMessagePolicy: File
            volumeMounts:
            - mountPath: /sock
              name: uds-socket
          - args:
            - proxy
            - --serviceCluster
            - istio-telemetry
            - --templateFile
            - /etc/istio/proxy/envoy_telemetry.yaml.tmpl
            - --controlPlaneAuthPolicy
            - MUTUAL_TLS
            env:
            - name: POD_NAME
              valueFrom:
                fieldRef:
                  apiVersion: v1
                  fieldPath: metadata.name
            - name: POD_NAMESPACE
              valueFrom:
                fieldRef:
                  apiVersion: v1
                  fieldPath: metadata.namespace
            - name: INSTANCE_IP
              valueFrom:
                fieldRef:
                  apiVersion: v1
                  fieldPath: status.podIP
            image: docker.io/istio/proxyv2:1.0.4
            imagePullPolicy: IfNotPresent
            name: istio-proxy
            ports:
            - containerPort: 15090
              name: http-envoy-prom
              protocol: TCP
            resources:
              requests:
                cpu: 10m
            terminationMessagePath: /dev/termination-log
            terminationMessagePolicy: File
            volumeMounts:
            - mountPath: /etc/certs
              name: istio-certs
              readOnly: true
            - mountPath: /sock
              name: uds-socket
          dnsPolicy: ClusterFirst
          restartPolicy: Always
          schedulerName: default-scheduler
          securityContext: {}
          serviceAccount: istio-mixer-service-account
          serviceAccountName: istio-mixer-service-account
          terminationGracePeriodSeconds: 30
          volumes:
          - name: istio-certs
            secret:
              defaultMode: 420
              optional: true
              secretName: istio.istio-mixer-service-account
          - emptyDir: {}
            name: uds-socket
    
    apiVersion:extensions/v1beta1
    种类:部署
    元数据:
    注释:
    标签:
    图表:混合器-1.0.4
    istio:混音器
    发布:istio
    名称:istio遥测
    名称空间:istio系统
    规格:
    进度死线秒数:600
    副本:2份
    修订历史限制:10
    选择器:
    火柴标签:
    应用程序:遥测
    istio:混音器
    istio混频器类型:遥测
    战略:
    滚动更新:
    最大涌浪:1
    马克斯:1
    类型:RollingUpdate
    模板:
    元数据:
    注释:
    scheduler.alpha.kubernetes.io/critical-pod:“
    sidecar.istio.io/inject:“false”
    creationTimestamp:空
    标签:
    应用程序:遥测
    istio:混音器
    istio混频器类型:遥测
    规格:
    容器:
    -args:#混合进程的标志
    ---地址#标记在两个不同的行上
    - unix:///sock/mixer.socket
    ---configStoreURL=k8s://#带有“=”的标志
    ---configDefaultNamespace=istio系统
    ---trace_zipkin_url=http://zipkin:9411/api/v1/spans
    
    ---log_output_level=attributes:warn,api:error#这就是我解决问题的方法,以及一些有关新Istio版本的有用信息

    Istio v1.0.2: 大量日志由以下程序生成:

    stdio适配器使Istio能够将日志和度量输出到 本地机器。日志和指标可以直接指向混合器的标准 输出流、标准错误流或任何本地可访问的 文件

    在Istiov1.0.2中,默认情况下启用了该适配器,将日志流式传输到混合器容器
    stderr
    。为了暂时解决这个问题,我:

    删除这些规则不会影响普罗米修斯度量(由处理)

    Istio v1.1.0+: 在此版本中,Istio引入了
    mixer.adapters.stdio.enabled
    ,默认情况下禁用stdio适配器,包括:

    #stdio是istio遥测中的调试适配器,不推荐使用 供生产使用

    在以下PRs中进行了更改:


    我正试图重现您的案例,很有意思的是,这个日志文件中有什么内容,您能发布它的头尾吗?另外,你对混音器使用任何自定义配置吗?@ArtemGolenyaev我重新启动了遥测吊舱以获取新的日志。是包含混合器遥测容器日志的gist文件。第一行报告处理程序和配置的警告和错误。剩下的行是来自我的服务网格的请求(容器到容器,容器到rds,等等),我不需要记录所有这些请求,它们是问题所在。。。Istio配备了官方掌舵图;没有自定义配置的混音器。感谢所有的详细信息!我很快就会试一试。我有一个问题:如果我降低混合器
    ——log\u output\u level
    ,发送给普罗米修斯的度量值会受到影响吗?i、 例如,Istio Grafana仪表盘将缺少信息。我认为没有,因为它是关于混音器应用程序的日志。但当然,你们需要检查一下才能确定。阿泰姆,我终于成功了……不幸的是,你们的建议不起作用,但却导致了我的问题。日志是由
    适配器
    生成的,该适配器不能由
    mi控制
    
    kubectl delete rule stdio --namespace=istio-system
    kubectl delete rule stdio-tcp --namespace=istio-system