Pods

更新时间:
复制 MD 格式

A pod is the smallest deployable unit in Kubernetes. It represents a single, running instance of an application. A pod can consist of a single container or multiple tightly coupled containers.

Note

Pods are a native concept in Kubernetes. For more information, see the official Kubernetes documentation.

Create pods

This section describes how to create a pod from a YAML file.

Procedure

  1. Log on to the Container Application Service console. In the navigation pane on the left, click Workloads > Pods.

  2. On the Pods page, click Create from YAML.

  3. Enter the YAML content and click Submit.

    The following is an example:

    kind: Pod
    metadata:
      name: nginx
      labels:
      k8s-app: nginx
      namespace: yournamespace  # Change this to your current namespace name
    spec:
      containers:
      - name: nginx
      image: reg-cnsh.cloud.alipay.com/library/nginx:latest

After the pod is created, its status is Running.

Edit pods

This section describes how to update a pod by modifying its YAML file.

Prerequisites

The YAML file has been created.

Procedure

  1. Log on to the Container Application Service console. In the navigation pane on the left, click Workloads > Pods.

  2. On the Container Group Pods page, click View/Edit YAML.

  3. In the Edit YAML dialog box, modify the configuration and click Update.

    After a successful update, the system automatically deploys Pods based on the updated YAML file.

Delete pods

This section describes how to delete a pod.

Prerequisites

The YAML file has been created.

Procedure

  1. Log on to the Container Application Service console. In the navigation pane on the left, click Workloads > Pods.

  2. On the Pods page, find the pod that you want to delete and click Delete in the Actions column. In the dialog box that appears, click OK.