k8s 基础 pod操作

时间:2023-12-30 08:06:02
  • 创建hell world pod

  • #vim hello-world-pod.yaml
    
    apiVersion: v1
    kind: Pod
    metadata:
    name: hello-world
    spec: 配置pod的具体规格
    restartPolicy: OnFailure
    containers:
    - name: hello
    image: "ubuntu:14.04"
    command: ["/bin/echo","Hello","world"] #kubectl create -f hello-world-pod.yaml #kubectl get pod hello-world 查询 也可以用kubectl describe pod helloworld #kubectl logs hello-world
  • 删除 pod

  • kubectl delete pod hello
  • 更新Pod

  • kubctl replace hello-world.yaml