[root@k8s-master-node1 ~]# docker pull nginx
[root@k8s-master-node1 ~]# kubectl run centos --image centos:latest --dry-run=client --port=80 -oyaml >nginx.yaml
yaml
bjiapiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
run: nginx
name: nginx
spec:
containers:
- image: nginx:latest
name: nginx
ports:
- containerPort: 80
volumeMounts:
- name: timezone
mountPath: /etc/localtime
volumes:
- name: timezone
hostPath:
path: /etc/localtime
dnsPolicy: ClusterFirst
restartPolicy: Always
status: {}
[root@k8s-master-node1 ~]# kubectl apply -f nginx.yaml
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
暂无评论内容