直接使用volumes hostpath方式,可以直接挂载本机目录。
{
"kind": "Deployment",
"apiVersion": "extensions/v1beta1",
"metadata": {
"name": "klog",
"namespace": "default",
"selfLink": "/apis/extensions/v1beta1/namespaces/default/deployments/klog",
"uid": "ff4184dc-f5e2-11e7-b76a-02602dd78f2c",
"resourceVersion": "216718",
"generation": 6,
"creationTimestamp": "2018-01-10T08:48:15Z",
"labels": {
"app": "klog"
},
"annotations": {
"deployment.kubernetes.io/revision": "5"
}
},
"spec": {
"replicas": 1,
"selector": {
"matchLabels": {
"app": "klog"
}
},
"template": {
"metadata": {
"name": "klog",
"creationTimestamp": null,
"labels": {
"app": "klog"
}
},
"spec": {
"volumes": [
{
"name": "datalogs",
"hostPath": {
"path": "/data/logs",
"type": ""
}
}
],
"containers": [
{
"name": "klog",
"image": "172.172.20.28:9800/app/klog_klog-web:pro",
"resources": {},
"volumeMounts": [
{
"name": "datalogs",
"mountPath": "/opt/tomcat/logs/jplugin-work/klog-web/logs/"
}
],
"terminationMessagePath": "/dev/termination-log",
"terminationMessagePolicy": "File",
"imagePullPolicy": "IfNotPresent",
"securityContext": {
"privileged": false
}
}
],
"restartPolicy": "Always",
"terminationGracePeriodSeconds": 30,
"dnsPolicy": "ClusterFirst",
"nodeSelector": {
"nginx": "waiwang"
},
"securityContext": {},
"schedulerName": "default-scheduler"
}
},
"strategy": {
"type": "RollingUpdate",
"rollingUpdate": {
"maxUnavailable": 1,
"maxSurge": 1
}
}
},
"status": {
"observedGeneration": 6,
"replicas": 1,
"updatedReplicas": 1,
"readyReplicas": 1,
"availableReplicas": 1,
"conditions": [
{
"type": "Available",
"status": "True",
"lastUpdateTime": "2018-01-10T08:48:37Z",
"lastTransitionTime": "2018-01-10T08:48:37Z",
"reason": "MinimumReplicasAvailable",
"message": "Deployment has minimum availability."
}
]
}
}