You can call APIs to create a pod. An Nginx image is used as an example to show how you can create a pod.
The Nginx image is from the open-source image center, and the container uses 1 vCPU and 2 GiB of memory.
For details about how to call APIs, see Calling APIs.
{
"apiVersion": "cci/v2",
"kind": "Namespace",
"metadata": {
"name": "namespace-test"
}
}
You must specify the following parameters:
{
"apiVersion": "yangtse/v2",
"kind": "Network",
"metadata": {
"annotations": {
"yangtse.io/domain-id": "51ed88507a244b6eb36270c0250fcc96",
"yangtse.io/project-id": "a81f079abca74e83b47af9a586048b24"
},
"name": "test-network",
"namespace": "namespace-test"
},
"spec": {
"networkType": "underlay_neutron",
"securityGroups": [
"470b6a8f-612e-4284-a788-c6900ac32fce"
],
"subnets": [
{
"subnetID": "c6dd31e3-d217-4b31-bb60-eb30322c75b8"
}
]
}
}
You must specify the following parameters:
In this example, a pod whose name is nginx and specifications are set to 1 vCPU and 2 GiB of memory will be created from the open-source image nginx:stable-alpine-perl. After the API is called, CCI creates a container running nginx.
{
"apiVersion": "cci/v2",
"kind": "Pod",
"metadata": {
"name": "nginx"
},
"spec": {
"containers": [
{
"image": "nginx:stable-alpine-perl",
"name": "container-0",
"resources": {
"limits": {
"cpu": "1",
"memory": "2Gi"
},
"requests": {
"cpu": "1",
"memory": "2Gi"
}
}
}
],
"imagePullSecrets": [
{
"name": "imagepull-secret"
}
]
}
}
You must specify the following parameters:
After the pod is created, you can view it on the CCI console.
