k8s容器看日志中文乱码、时区问题、host问题

一般这样都是默认编码不支持当前字符的问题
修改环境变量后,在查看

LANG=C.utf8

查看修改时区

date +"%Z %z"
-Duser.timezone=GMT+08  //java特有
/etc/localtime //通用
/etc/timezone //debian

添加host

apiVersion: v1
kind: Pod
metadata:
  name: hostaliases-pod
spec:
  restartPolicy: Never
  hostAliases:
  - ip: "127.0.0.1"
    hostnames:
    - "foo.local"
    - "bar.local"
  - ip: "1.1.1.1"
    hostnames:
    - "foo.remote"
  containers:
  - name: cat-hosts
    image: 'registry.cn-hangzhou.aliyuncs.com/bigteam/filebeat:v5'
    command:
    - cat
    args:
    - "/etc/hosts"
posted @ 2021-07-12 14:54  doite  阅读(4225)  评论(0)    收藏  举报