数据库
MySQL
ORACLE
占位哈哈
占位哈哈
占位哈哈
占位哈哈
占位哈哈
占位哈哈
占位哈哈
占位哈哈
Linux运维
中间件
shell脚本
占位哈哈
占位哈哈
占位哈哈
占位哈哈
占位哈哈
占位哈哈
占位哈哈
首页 动态 发帖 版块 我的
 退出
游客  
等级:
金豆:
经验:
首页  /  云计算  /  kubernetes  /  正文

使用kubectl run运行pod

  878 
 0
 1

创建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"

标签:
作者签名: 只有努力,才会有收获   楼主  2021-12-06 17:29:35
回复列表
合作伙伴:
Powered by 运维术 8.4.13
© 2017-2024 模板 by 黑衣人
您的IP: 18.224.30.113 , 2024-11-23 15:57:20
Powered by 运维术 8.4.13
© 2017-2024 模板 by 黑衣人
(1) 分享
分享
取消
我的客服