HCIP-Cloud Computing-Container V1.0 实验指导手册
1.1 Pod 实验
1.1.1 使用 Pod
步骤 1 创建 podfile 目录
[root@k8s-master]# mkdir /labfile/podfile
[root@k8s-master]# cd /labfile/podfile
步骤 2 编写 mypod.yaml
[root@k8s-master podfile]# vim mypod.yaml
kind: Pod
apiVersion: v1
metadata:
name: mypod
spec:
containers:
- name: mypod
image: busybox
args:
- /bin/sh
- -c
- sleep 30000
步骤 3 创建 pod
[root@k8s-master podfile]# kubectl apply -f mypod.yaml
步骤 4 查看 pod
[root@k8s-master podfile]# kubectl get pod
NAME READY STATUS RESTARTS AGE
mypod 1/1 Running 0 72s
步骤 5 查看 yaml 输出格式的 pod 信息
[root@k8s-master podfile]# kubectl get pod mypod -o yaml
apiVersion: v1
kind: Pod
metadata:
annotations:
评论0