apiVersion: v1
kind: Pod
metadata:
name: pod-demo
namespace: app
labels:
app: centos7
release: stable
environment: dev
spec:
containers:
- name: centos
image: harbor.od.com/public/centos:7
command:
- /bin/bash
- -c
- "sleep 3600"
[root@hdss7-21 ~]# kubectl apply -f http://k8s-yaml.od.com/base_resource/pods/myapp.yaml
[root@hdss7-21 ~]# kubectl get pod -o wide -n app
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
pod-demo 1/1 Running 0 16s 172.7.22.2 hdss7-22.host.com <none> <none>
[root@hdss7-21 ~]# kubectl exec pod-demo -n app -- ps uax
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 4364 352 ? Ss 04:41 0:00 sleep 3600
root 11 0.0 0.0 51752 1696 ? Rs 04:42 0:00 ps uax
[root@hdss7-21 ~]# kubectl describe pod pod-demo -n app | tail
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 3m46s default-scheduler Successfully assigned app/pod-demo to hdss7-22.host.com
Normal Pulling 3m45s kubelet, hdss7-22.host.com Pulling image "harbor.od.com/public/centos:7"
Normal Pulled 3m45s kubelet, hdss7-22.host.com Successfully pulled image "harbor.od.com/public/centos:7"
Normal Created 3m45s kubelet, hdss7-22.host.com Created container centos
Normal Started 3m45s kubelet, hdss7-22.host.com Started container centos