• 编写petclinic-pod.yml

      1. apiVersion: v1
      2. kind: Pod
      3. metadata:
      4. name: petclinic
      5. spec:
      6. containers:
      7. - name: petclinic
      8. image: xushencong/petclinic:v1
    • 部署pod ```shell [~/docker/pod-in-action]$ kubectl apply -f 01/. pod/petclinic created [~/docker/pod-in-action]$ kubectl get all NAME READY STATUS RESTARTS AGE pod/petclinic 1/1 Running 0 87s

    NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE service/kubernetes ClusterIP 10.96.0.1 443/TCP 6h50m

    
    - 端口转发(生产不要使用)
    ```shell
    [~/docker/pod-in-action]$ kubectl port-forward petclinic 8080:8080
    Forwarding from 127.0.0.1:8080 -> 8080
    Forwarding from [::1]:8080 -> 8080
    Handling connection for 8080
    Handling connection for 8080
    

    http://localhost:8080http://127.0.0.1:8080 都可以访问
    截屏2022-02-08 19.24.03.png