创建pod
[minikube@vgt06e3nlwz0envk ~]$ kubectl run pod-run --image=tomcat:8.5-jre8-alpine --image-pull-policy=IfNotPresent --port=8080 pod/pod-run created
查看创建的pod
查看yaml资源文件
[minikube@vgt06e3nlwz0envk ~]$ kubectl get pods pod-run -o yaml
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: "2021-12-06T09:23:21Z"
labels:
run: pod-run
name: pod-run
namespace: default
resourceVersion: "298311"
uid: 5addcf43-5c3e-4896-a7f0-3afc15b00a37
spec:
containers:
- image: tomcat:8.5-jre8-alpine
imagePullPolicy: IfNotPresent
name: pod-run
ports:
- containerPort: 8080
protocol: TCP
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /var/run/secrets/kubernetes.io/serviceaccount
name: kube-api-access-lrclp
readOnly: true
dnsPolicy: ClusterFirst
enableServiceLinks: true
nodeName: minikube
preemptionPolicy: PreemptLowerPriority
priority: 0
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
serviceAccount: default
serviceAccountName: default
terminationGracePeriodSeconds: 30
tolerations:
- effect: NoExecute
key: node.kubernetes.io/not-ready
operator: Exists
tolerationSeconds: 300
- effect: NoExecute
key: node.kubernetes.io/unreachable
operator: Exists
tolerationSeconds: 300
volumes:
- name: kube-api-access-lrclp
projected:
defaultMode: 420
sources:
- serviceAccountToken:
expirationSeconds: 3607
path: token
- configMap:
items:
- key: ca.crt
path: ca.crt
name: kube-root-ca.crt
- downwardAPI:
items:
- fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
path: namespace
status:
conditions:
- lastProbeTime: null
lastTransitionTime: "2021-12-06T09:23:21Z"
status: "True"
type: Initialized
- lastProbeTime: null
lastTransitionTime: "2021-12-06T09:23:27Z"
status: "True"
type: Ready
- lastProbeTime: null
lastTransitionTime: "2021-12-06T09:23:27Z"
status: "True"
type: ContainersReady
- lastProbeTime: null
lastTransitionTime: "2021-12-06T09:23:21Z"
status: "True"
type: PodScheduled
containerStatuses:
- containerID: docker://cb4221219cd6227acd5359c9ef2c30ef625e464667eaefb2089c095a47b05c2f
image: tomcat:8.5-jre8-alpine
imageID: docker-pullable://tomcat@sha256:04feaf74f8bb54b43ea136b150bbc7b58e8a3062aead67ab871f2dbbd5dac5d1
lastState: {}
name: pod-run
ready: true
restartCount: 0
started: true
state:
running:
startedAt: "2021-12-06T09:23:26Z"
hostIP: 192.168.49.2
phase: Running
podIP: 172.17.0.10
podIPs:
- ip: 172.17.0.10
qosClass: BestEffort
startTime: "2021-12-06T09:23:21Z"