Why Can't My ECS Use Cloud-init?
Symptom
An ECS is not able to use cloud-init.
Troubleshooting
Check the following possible causes.
Possible Cause |
Solution |
---|---|
The ECS has no IP address obtained. |
|
Incorrect route for 169.254.169.254 |
|
Fail to obtain the ECS metadata. |
|
Fail to log in to the ECS or create a non-root user after cloud-init is configured. |
Check the format of the /etc/cloud/cloud.cfg configuration file. For details, see Cannot Log in to the ECS or Create a Non-root User After Cloud-init Is Configured. |
Fail to use an obtained private key to log in to an ECS after the ECS starts (Fail to obtain the ECS login password). |
Restart the ECS and try again. |
The ECS Has Not Obtained IP Address
Check whether the ECS has obtained an IP address.
If no IP address is obtained, run the dhclient command to obtain the IP address (this command varies depending on the ECS OSs). Alternatively, you can run the ifdown ethx command to disable the network port and then run the ifup ethx command to enable it to allow the ECS NIC to automatically obtain an IP address again.
Incorrect Route for 169.254.169.254
- Check the exact route configured on the ECS for IP address 169.254.169.254/32.
In most cases, the next hop of the exact route for IP address 169.254.169.254/32 is the same as that of the default route for the IP address.
Figure 4 Route for IP address 169.254.169.254/32
- If there is no exact route for IP address 169.254.169.254/32, the cause is as follows:
Images with CentOS 5 OSs are not compatible with cloud-init. To use cloud-init, select a different OS.
- If the next hop of the exact route for IP address 169.254.169.254/32 is different from that of the default route for the IP address:
- If the ECS was created before cloud-init was enabled, run service network restart to obtain the correct route.
- If the ECS is newly created, submit a service ticket or contact technical support.
Did Not Obtain the ECS Metadata
Run the following command on the ECS to obtain the metadata:
curl http://169.254.169.254/openstack/latest/meta_data.json
If information similar to that shown in Figure 5 is displayed, the ECS successfully obtains the metadata.
Cannot Log in to the ECS or Create a Non-root User After Cloud-init Is Configured
Check whether the /etc/cloud/cloud.cfg configuration file format is correct. For details, see the file format requirements for different Linux distributions. The following figure shows an example /etc/cloud/cloud.cfg configuration file for Ubuntu.
Obtained Private Key Cannot Be Used to Log in to an ECS After the ECS Starts (Failed to Obtain the ECS Login Password)
Restart the ECS to rectify the fault.
Submitting a Service Ticket
If the EIP still fails to use cloud-init after performing the preceding steps, submit a service ticket.
Provide the following information to the technical support engineer.
Item |
Description |
Example |
Value |
---|---|---|---|
VPC CIDR block |
Required for customer gateway configuration |
Example: 10.0.0.0/16 |
N/A |
VPC ID |
N/A |
Example: 120b71c7-94ac-45b8-8ed6-30aafc8fbdba |
N/A |
CIDR block of subnet 1 (can be the same as the VPC CIDR block) |
N/A |
Example: 10.0.1.0/24 |
N/A |
ECS ID |
N/A |
N/A |
N/A |
ECS IP address |
N/A |
Example: 192.168.1.192/24 |
N/A |
ECS route information |
N/A |
N/A |
N/A |
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