赞
踩
目录
vi emptydir.yamlapiVersion: v1kind: Podmetadata:name: pod1spec:containers:- name: write # 业务容器(写数据)image: centoscommand: ["bash","-c","for i in {1..100};do echo $i >> /data/hello;sleep 1;done"]volumeMounts:- name: datamountPath: /data- name: read # 辅助容器(读数据)image: centoscommand: ["bash","-c","tail -f /data/hello"]volumeMounts:- name: datamountPath: /datavolumes:- name: dataemptyDir: {}
kubectl apply -f emptydir.yaml
vi hostPath.yaml
apiVersion: v1kind: Podmetadata:name: pod2spec:containers:- name: write # 业务容器(写数据)image: centoscommand: ["bash","-c","for i in {1..1000};do echo $i >> /data/hello;sleep 1;done"]volumeMounts:- name: datamountPath: /tttvolumes:- name: datahostPath:path: /tmptype: Directory
kubectl get pods -o wide
apiVersion: v1kind: Podmetadata:name: pod2spec:containers:- name: write # 业务容器(写数据)image: centoscommand: ["bash","-c","for i in {1..1000};do echo $i >> /data/hello;sleep 1;done"]volumeMounts:- name: datamountPath: /ttt- name: data2mountPath: /ttt2volumes:- name: datahostPath:path: /tmptype: Directory- name: data2hostPath:path: /type: Directory
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。