fluentd 容器未通过 yaml (1.2) 安装 k8 worker 目录
fluentd container not mounting k8 worker directories via yaml (1.2)
当我手动 运行 一个容器时,我看到了挂载,但是通过 yaml,挂载是空的。
apiVersion: v1
kind: Pod
metadata:
name: fluentd2elasticsearch
namespace: kube-system
spec:
containers:
- name: fluentd-es
image: gcr.io/google_containers/fluentd-elasticsearch:1.15
env:
- name: FLUENTD_ARGS
value: "-qq"
volumeMounts:
- name: containers
mountPath: /var/lib/docker/containers
- name: varlog
mountPath: /var/log
volumes:
- name: containers
source:
hostDir:
path: /var/lib/docker/containers
- name: varlog
source:
hostDir:
path: /var/log
当我连接到容器时,目录为空或仅包含 fluentd pod 文件。
运行 手动:
docker run -d -v /var/lib/docker/containers:/var/lib/docker/containers -v /var/log:/var/log gcr.io/google_containers/fluentd-elasticsearch:1.15
一切看起来都很棒,但我需要 kuber 来启动容器以使其与 elasticsearch 通信(在 kubernetes 或 k8 中,我有时看到写的)。
docker 检查显示:
"Mounts": [
{
"Source": "/var/lib/kubelet/pods/1c11495ddc980659911fd7a596a346f8/volumes/kubernetes.io~empty-dir/containers",
"Destination": "/var/lib/docker/containers",
"Mode": "",
"RW": true
},
{
"Source": "/var/lib/kubelet/pods/1c11495ddc980659911fd7a596a346f8/volumes/kubernetes.io~empty-dir/varlog",
"Destination": "/var/log",
"Mode": "",
"RW": true
},
我猜 kubernetes.io~empty-dir 不是我想在那里看到的。
卷部分似乎存在一些结构问题。尝试:
volumes:
- name: containers
hostPath:
path: /var/lib/docker/containers
- name: varlog
hostPath:
path: /var/log
当我手动 运行 一个容器时,我看到了挂载,但是通过 yaml,挂载是空的。
apiVersion: v1
kind: Pod
metadata:
name: fluentd2elasticsearch
namespace: kube-system
spec:
containers:
- name: fluentd-es
image: gcr.io/google_containers/fluentd-elasticsearch:1.15
env:
- name: FLUENTD_ARGS
value: "-qq"
volumeMounts:
- name: containers
mountPath: /var/lib/docker/containers
- name: varlog
mountPath: /var/log
volumes:
- name: containers
source:
hostDir:
path: /var/lib/docker/containers
- name: varlog
source:
hostDir:
path: /var/log
当我连接到容器时,目录为空或仅包含 fluentd pod 文件。 运行 手动:
docker run -d -v /var/lib/docker/containers:/var/lib/docker/containers -v /var/log:/var/log gcr.io/google_containers/fluentd-elasticsearch:1.15
一切看起来都很棒,但我需要 kuber 来启动容器以使其与 elasticsearch 通信(在 kubernetes 或 k8 中,我有时看到写的)。
docker 检查显示:
"Mounts": [
{
"Source": "/var/lib/kubelet/pods/1c11495ddc980659911fd7a596a346f8/volumes/kubernetes.io~empty-dir/containers",
"Destination": "/var/lib/docker/containers",
"Mode": "",
"RW": true
},
{
"Source": "/var/lib/kubelet/pods/1c11495ddc980659911fd7a596a346f8/volumes/kubernetes.io~empty-dir/varlog",
"Destination": "/var/log",
"Mode": "",
"RW": true
},
我猜 kubernetes.io~empty-dir 不是我想在那里看到的。
卷部分似乎存在一些结构问题。尝试:
volumes:
- name: containers
hostPath:
path: /var/lib/docker/containers
- name: varlog
hostPath:
path: /var/log