云容器实例 CCI-调用API创建负载:Namespace

时间:2024-10-29 16:37:49

Namespace

  1. 调用创建Namespace接口创建命名空间,并指定使用命名空间的类型。

    {
        "apiVersion": "v1",
        "kind": "Namespace",
        "metadata": {
            "name": "namespace-test",
            "annotations": {
                "namespace.kubernetes.io/flavor": "gpu-accelerated"
            }
        },
        "spec": {
            "finalizers": [
                "kubernetes"
            ]
        }
    }

  2. 调用创建Network接口创建网络,与VPC与子网关联。

    {
        "apiVersion": "networking.cci.io/v1beta1",
        "kind": "Network",
        "metadata": {
            "annotations": {
                "network.alpha.kubernetes.io/default-security-group": "{{security-group-id}}",
                "network.alpha.kubernetes.io/domain-id": "{{domain-id}}",
                "network.alpha.kubernetes.io/project-id": "{{project-id}}"
            },
            "name": "test-network"
        },
        "spec": {
            "availableZone": "{{zone}}",
            "cidr": "192.168.0.0/24",
            "attachedVPC": "{{vpc-id}}",
            "networkID": "{{network-id}}",
            "networkType": "underlay_neutron",
            "subnetID": "{{subnet-id}}"
        }
    }

support.huaweicloud.com/bestpractice-cci/cci_04_0005.html