subPathExpr 使用
1、如下yaml文件apiVersion: apps/v1kind: Deploymentmetadata:annotations:deployment.kubernetes.io/revision: "7"generation: 7labels:k8s-app: busyboxqcloud-app: busyboxmanagedFields:- apiVersion: apps/v1manage
·
1、如下yaml文件
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
deployment.kubernetes.io/revision: "7"
generation: 7
labels:
k8s-app: busybox
qcloud-app: busybox
managedFields:
- apiVersion: apps/v1
manager: tke-apiserver
operation: Update
- apiVersion: apps/v1
manager: kube-controller-manager
operation: Update
name: busybox
namespace: default
spec:
progressDeadlineSeconds: 600
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
k8s-app: busybox
qcloud-app: busybox
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
type: RollingUpdate
template:
metadata:
creationTimestamp: null
labels:
k8s-app: busybox
qcloud-app: busybox
spec:
containers:
- args:
- -c
- sleep 30000;
command:
- /bin/sh
env:
- name: MY_POD_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.name
image: busybox:latest
imagePullPolicy: Always
lifecycle:
postStart:
exec:
command:
- /bin/sh
- -c
- mkdir -p /tmp/${MY_POD_NAME}
name: busybox
resources:
limits:
cpu: 500m
memory: 400Mi
requests:
cpu: 250m
memory: 256Mi
securityContext:
privileged: false
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /var/log/pods
name: logdir
subPathExpr: $(MY_POD_NAME)
dnsPolicy: ClusterFirst
imagePullSecrets:
- name: qcloudregistrykey
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
volumes:
- hostPath:
path: /logs
type: DirectoryOrCreate
name: logdir
更多推荐
已为社区贡献45条内容
所有评论(0)