Creating an Agent
Overview
You can install an agent on a host and connect the host to CodeArts for registration. You can customize execution resource connection.
Install only one agent on an agent host. If multiple agents are installed, some of them may go offline during task execution.
Prerequisites
- Your account must be:
- A tenant account.
- Or an IAM user who has the agent pool owner, manager, or user permission.
- The host where you want to install an agent must meet the following requirements:
- Specifications: 4 vCPUs | 8 GB or above, disk space > 80 GB
- Java 8 and Git are installed. If the agent pool type is LINUX_DOCKER, Docker must also be installed on the host.
- If you use a Linux host, you can choose auto agent installation, or manually install the agent using the root account.
- If you use a Windows or macOS host, manually install the agent on it.
- VPCEP has been configured.
Configuring VPCEP
- Log in to the console, and click VPC Endpoint.
- Click Create VPC Endpoint, configure the following information, and click Create Now.
Table 1 Creating a VPC endpoint Parameter
Description
Service Category
Select Find a service by name.
VPC Endpoint Service Name
Submit a service ticket to obtain the information and enter it. Click Verify.
If the message "Service name found." is displayed, the verification is successful.
VPC
Select a VPC. If there is no VPC, click Create VPC in the drop-down list to create one.
Subnet
Select a subnet. If there is no subnet, click Create Subnet in the drop-down list to create one.
IPv4 address
Select Automatically assign IP address.
- In the VPC endpoint list, locate the created VPC endpoint and record its IP address.
- Click
in the upper left, and click Domain Name Service in the service list. - Click Create Private Zone. In the displayed dialog box, set the following information and click OK.
Table 2 Creating a private zone Parameter
Description
Domain Name
Submit a service ticket to obtain the information and enter the information.
VPC
Select the same VPC as the one in 2.
Enterprise Project
Select an existing enterprise project. If there is no enterprise project, click Create Enterprise Project to create one.
- Locate the created private zone, and click Manage Record Set in the Operation column.
- Click Add Record Set, enter the IP address recorded in 3 in the Value text box, and click OK.
Creating an Agent
- After completing the operations described in Creating an Agent Pool, find the target agent pool in the agent pool list and click its name to display the Agents tab page.
- Click Create Agent. A dialog box is displayed.
- Configure parameters as required.
- Configure the network environment for the host.
Table 3 Configuration 1 Configuration Item
Description
Install a JDK automatically
The host must have a Java 8 environment.
After this function is enabled, the JDK is automatically installed in the /usr/local directory of the host.
If this function is disabled, you need to manually install a JDK. How Do I Install Java 8?
NOTE:This configuration item is displayed only when the agent pool type is LINUX or LINUX_DOCKER.
Install Git automatically
The host must have a Git environment.
After this function is enabled, Git is automatically installed on the host.
If this function is disabled, you need to manually install Git. How Do I Install Git?
NOTE:This configuration item is displayed only when the agent pool type is LINUX or LINUX_DOCKER.
Install Docker
The host must have a Docker environment.
After this function is enabled, the Docker is automatically installed in the /usr/bin directory of the host. After the installation is complete, the service is automatically registered and the Docker service is started.
If this function is disabled, you need to manually install Docker. How Do I Install Docker?
NOTE:This configuration item is displayed only when the agent pool type is LINUX or LINUX_DOCKER.
- Configure authentication information.
Table 4 Configuration 2 Configuration Item
Description
AK
Access key ID.
Obtain it from the access key file by choosing My Credential > Access Keys. For details, see "Obtaining an AK/SK" in the API Signature Guide.
SK
Secret access key.
Obtain it from the access key file by choosing My Credential > Access Keys. For details, see "Obtaining an AK/SK" in the API Signature Guide.
Agent Name
Agents with the same name cannot be installed on the same host.
Set this parameter based on the site requirements. To facilitate management, it is recommended that the name be clear and associated with the agent IP address, such as 10.10.10.10-agent-01.
Agent Workspace
The working directory where the agent runs on the host and the workspace where tasks are executed. Different agents of the same host cannot use the same agent workspace.
For easy management, specify a data disk. Example:
- Linux: /opt/cloud/agent01
- Windows: C:/opt/cloud/agent01
- macOS: /opt/cloud/agent01
- Generate a command.
Set the parameters, agree to the statements, and click Generate Command. The command for installing the agent is automatically generated in the command box.
Click Copy Command.
- Configure the network environment for the host.
- Log in to the host and run the installation command copied in the previous step.
- Linux host: Log in using the root account and then run the installation command.
- Windows host: Log in as the administrator, open Git Bash, and then run the installation command.
- macOS host: Log in using the root account and then run the installation command.
If the following message is displayed, the installation is complete.
- Return to the Agents tab page and close the dialog box.
After 10 to 30 seconds, check the status of the installed agent instance on the Agents tab page. If the status is Idle, the installation is successful.
Follow-up Procedure
- View the agent list.
In the agent pool list, find the target agent pool and click its name to display the Agents tab page.
The agent list displays the agent status, memory usage, and available hard disk space.
An agent can be in any of the following states:
Table 5 Agent states Agent State
Description
Running
The agent is performing tasks.
Idle
The agent is connected, and no tasks are running.
Disabled
The agent is connected, but is disabled to perform tasks.
Offline
The agent is disconnected. If you want it to go online, log in to the agent to re-register. Otherwise, you can delete the agent.
Deleting
The agent is being deleted.
- Delete an agent.
- Deleting a single agent: On the Agents tab, click
in the Operation column of the target agent to delete it. - Deleting multiple agents: On the Agents tab, select the target agents and click Batch Delete.
Agents in the Running state cannot be deleted.
- Deleting a single agent: On the Agents tab, click
- Start or stop the agent.
On the Agents tab page, click
in the Operation column to disable the agent. After the agent is disabled, the status changes to Disabled. Click
to enable the agent again and the status changes to Idle.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot