0

登录 /var/log/cloud-init-output.log 我正在尝试从 ec2 实例运行 K8s 集群,并已安装 eksctl、aws cli 以及 ec2 实例的用户数据中所需的一切。当我 ssh 并手动运行命令时它正在运行,但是当我将相同的命令放入 ec2 用户数据时它不起作用

cat: log.log: No such file or directory
[ec2-user@ip-172-31-46-149 ~]$ cat /var/log/cloud-init-output.log
Cloud-init v. 19.3-3.amzn2 running 'init-local' at Thu, 03 Dec 2020 22:34:36 +0000. Up 8.20 seconds.
Cloud-init v. 19.3-3.amzn2 running 'init' at Thu, 03 Dec 2020 22:34:40 +0000. Up 12.09 seconds.
ci-info: ++++++++++++++++++++++++++++++++++++++Net device info+++++++++++++++++++++++++++++++++++++++
ci-info: +--------+------+-----------------------------+---------------+--------+-------------------+
ci-info: | Device |  Up  |           Address           |      Mask     | Scope  |     Hw-Address    |
ci-info: +--------+------+-----------------------------+---------------+--------+-------------------+
ci-info: |  eth0  | True |        172.31.46.149        | 255.255.240.0 | global | 0e:67:9f:09:91:a5 |
ci-info: |  eth0  | True | fe80::c67:9fff:fe09:91a5/64 |       .       |  link  | 0e:67:9f:09:91:a5 |
ci-info: |   lo   | True |          127.0.0.1          |   255.0.0.0   |  host  |         .         |
ci-info: |   lo   | True |           ::1/128           |       .       |  host  |         .         |
ci-info: +--------+------+-----------------------------+---------------+--------+-------------------+
ci-info: ++++++++++++++++++++++++++++++++Route IPv4 info++++++++++++++++++++++++++++++++
ci-info: +-------+-----------------+-------------+-----------------+-----------+-------+
ci-info: | Route |   Destination   |   Gateway   |     Genmask     | Interface | Flags |
ci-info: +-------+-----------------+-------------+-----------------+-----------+-------+
ci-info: |   0   |     0.0.0.0     | 172.31.32.1 |     0.0.0.0     |    eth0   |   UG  |
ci-info: |   1   | 169.254.169.254 |   0.0.0.0   | 255.255.255.255 |    eth0   |   UH  |
ci-info: |   2   |   172.31.32.0   |   0.0.0.0   |  255.255.240.0  |    eth0   |   U   |
ci-info: +-------+-----------------+-------------+-----------------+-----------+-------+
ci-info: +++++++++++++++++++Route IPv6 info+++++++++++++++++++
ci-info: +-------+-------------+---------+-----------+-------+
ci-info: | Route | Destination | Gateway | Interface | Flags |
ci-info: +-------+-------------+---------+-----------+-------+
ci-info: |   9   |  fe80::/64  |    ::   |    eth0   |   U   |
ci-info: |   11  |    local    |    ::   |    eth0   |   U   |
ci-info: |   12  |   ff00::/8  |    ::   |    eth0   |   U   |
ci-info: +-------+-------------+---------+-----------+-------+
Cloud-init v. 19.3-3.amzn2 running 'modules:config' at Thu, 03 Dec 2020 22:34:43 +0000. Up 14.97 seconds.
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Existing lock /var/run/yum.pid: another copy is running as pid 3121.
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory :  31 M RSS (323 MB VSZ)
    Started: Thu Dec  3 22:34:42 2020 - 00:03 ago
    State  : Sleeping, pid: 3121
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory :  67 M RSS (360 MB VSZ)
    Started: Thu Dec  3 22:34:42 2020 - 00:05 ago
    State  : Running, pid: 3121
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory :  96 M RSS (389 MB VSZ)
    Started: Thu Dec  3 22:34:42 2020 - 00:07 ago
    State  : Running, pid: 3121
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory : 134 M RSS (427 MB VSZ)
    Started: Thu Dec  3 22:34:42 2020 - 00:09 ago
    State  : Running, pid: 3121
No packages needed for security; 0 packages available
No packages marked for update
Cloud-init v. 19.3-3.amzn2 running 'modules:final' at Thu, 03 Dec 2020 22:34:55 +0000. Up 26.29 seconds.
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   214  100   214    0     0   3754      0 --:--:-- --:--:-- --:--:--  3754
Error: failed to create cluster "twitter-clone"
Dec 03 22:35:02 cloud-init[3234]: util.py[WARNING]: Failed running /var/lib/cloud/instance/scripts/part-001 [1]
Dec 03 22:35:02 cloud-init[3234]: cc_scripts_user.py[WARNING]: Failed to run module scripts-user (scripts in /var/lib/cloud/instance/scripts)
Dec 03 22:35:02 cloud-init[3234]: util.py[WARNING]: Running module scripts-user (<module 'cloudinit.config.cc_scripts_user' from '/usr/lib/python2.7/site-packages/cloudinit/config/cc_scripts_user.pyc'>) failed
Cloud-init v. 19.3-3.amzn2 finished at Thu, 03 Dec 2020 22:35:03 +0000. Datasource DataSourceEc2.  Up 34.40 seconds

4

1 回答 1

0

你能添加你的用户数据吗?当我开始使用#!/bin/bash -xe. 我删除了-xe,一切都很好。

于 2020-12-10T15:04:12.857 回答