This section describes how to deploy a workload on CCE. When using CCE for the first time, create a cluster and add a node to the cluster.
Containerized workloads are deployed in a similar way. The difference lies in:
No. | Category | Procedure |
|---|---|---|
1 | Creating a VPC | Create a VPC before you create a cluster. A VPC provides an isolated, configurable, manageable virtual network environment for CCE clusters. If you already have a VPC, skip to the next task.
|
2 | Creating a key pair | Create a key pair before you create a containerized application. Key pairs are used for identity authentication during remote login to a node. If you already have a key pair, skip this task.
|
In this example, interconnection with the MySQL database is implemented through configuring the environment variables. Determine whether to use environment variables based on your service requirements.
Variable Name | Variable Value/Variable Reference |
|---|---|
MYSQL_DB | Database name. |
MYSQL_URL | IP address and port number of the database. |
MYSQL_USER | Database username. |
MYSQL_PASSWORD | Database user password. |
In this example, the MongoDB database is used and persistent data storage is also needed, so you need to configure cloud storage. Determine whether to use cloud storage based on your service requirements.
The mount path must be the same as the MongoDB storage path in the Docker startup script. For details, see the startup script. In this example, the path is /usr/local/mongodb/data.
to add a Service, configure the Service parameters, and click OK.In this example, the application can be accessed from the Internet through an EIP.
After the workload is created, you can view the running workload in the workload list.
After a workload is created, you can access the workload to check whether the workload has been deployed.
In the preceding configuration, a NodePort Service is configured for the workload. This means that you can access the workload using <node-IP-address>:port. If the workload can be accessed properly, it has been deployed.
You can obtain the access address from the Access Mode tab on the workload details page.