我阅读了AmazonECS文档和this文章,其中对每个术语进行了基本解释,包括:
Container Instance —这只是EC2实例,属于ECS集群,并在其上运行docker和ecs-agent。
我有点困惑。我认为每个task
都是一个container
,它运行在EC2 instance
集群的一部分ECS
上。那么EC2 instance
怎么会这样被称呼呢?还是EC2 instance
还是container
我错过了什么?
答案 0 :(得分:3)
当您想到容器实例时,请考虑:
被配置为通过具有ECS代理并成为ECS集群的一部分来运行容器(ECS任务)的EC2实例。
从本质上讲,ECS会跟踪与集群关联的EC2实例,包括有关它们的元数据。这意味着除了被作为EC2实例进行跟踪之外,它们还被作为“容器实例”进行跟踪。如果您已安装AWS CLI,请查看aws ecs describe-container-instances
,以了解有关容器实例的一些元数据。
$ aws ecs describe-container-instances --container-instance <container instance>
{
"failures": [],
"containerInstances": [
{
"status": "ACTIVE",
"registeredAt": 1442818969.168,
"registeredResources": [
{
"integerValue": 2048,
"longValue": 0,
"type": "INTEGER",
"name": "CPU",
"doubleValue": 0.0
},
{
"integerValue": 1957,
"longValue": 0,
"type": "INTEGER",
"name": "MEMORY",
"doubleValue": 0.0
},
{
"name": "PORTS",
"longValue": 0,
"doubleValue": 0.0,
"stringSetValue": [
"22",
"2376",
"2375",
"51678",
"51679"
],
"type": "STRINGSET",
"integerValue": 0
},
{
"name": "PORTS_UDP",
"longValue": 0,
"doubleValue": 0.0,
"stringSetValue": [],
"type": "STRINGSET",
"integerValue": 0
}
],
"ec2InstanceId": "i-98135490825890725",
"agentConnected": true,
"containerInstanceArn": "arn:aws:ecs:ca-central-1:23490141:container-instance/123984129047912347012340",
"pendingTasksCount": 0,
"remainingResources": [
{
"integerValue": 1923,
"longValue": 0,
"type": "INTEGER",
"name": "CPU",
"doubleValue": 0.0
},
{
"integerValue": 1925,
"longValue": 0,
"type": "INTEGER",
"name": "MEMORY",
"doubleValue": 0.0
},
{
"name": "PORTS",
"longValue": 0,
"doubleValue": 0.0,
"stringSetValue": [
"22",
"2376",
"2375",
"51678",
"51679"
],
"type": "STRINGSET",
"integerValue": 0
},
{
"name": "PORTS_UDP",
"longValue": 0,
"doubleValue": 0.0,
"stringSetValue": [],
"type": "STRINGSET",
"integerValue": 0
}
],
"version": 3197,
"attributes": [
{
"name": "com.amazonaws.ecs.capability.logging-driver.syslog"
},
{
"name": "ecs.ami-id",
"value": "ami-0f552e0a86f08b660"
},
{
"name": "com.amazonaws.ecs.capability.logging-driver.none"
},
{
"name": "com.amazonaws.ecs.capability.logging-driver.json-file"
},
{
"name": "ecs.capability.execution-role-awslogs"
},
{
"name": "ecs.vpc-id",
"value": "vpc-2309423409"
},
{
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.17"
},
{
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.18"
},
{
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.19"
},
{
"name": "ecs.capability.docker-plugin.local"
},
{
"name": "ecs.capability.task-eni"
},
{
"name": "ecs.capability.task-cpu-mem-limit"
},
{
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.30"
},
{
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.31"
},
{
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.32"
},
{
"name": "ecs.capability.execution-role-ecr-pull"
},
{
"name": "ecs.capability.container-health-check"
},
{
"name": "ecs.subnet-id",
"value": "subnet-13412345"
},
{
"name": "ecs.availability-zone",
"value": "us-east-1c"
},
{
"name": "ecs.instance-type",
"value": "t3.small"
},
{
"name": "com.amazonaws.ecs.capability.task-iam-role-network-host"
},
{
"name": "com.amazonaws.ecs.capability.logging-driver.awslogs"
},
{
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.24"
},
{
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.25"
},
{
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.26"
},
{
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.27"
},
{
"name": "com.amazonaws.ecs.capability.privileged-container"
},
{
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.28"
},
{
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.29"
},
{
"name": "ecs.cpu-architecture",
"value": "x86_64"
},
{
"name": "ecs.capability.cni-plugin-version",
"value": "93f43776-2018.10.0"
},
{
"name": "ecs.capability.secrets.ssm.environment-variables"
},
{
"name": "com.amazonaws.ecs.capability.ecr-auth"
},
{
"name": "ecs.capability.pid-ipc-namespace-sharing"
},
{
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.20"
},
{
"name": "ecs.os-type",
"value": "linux"
},
{
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.21"
},
{
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.22"
},
{
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.23"
},
{
"name": "com.amazonaws.ecs.capability.task-iam-role"
},
{
"name": "ecs.capability.private-registry-authentication.secretsmanager"
}
],
"versionInfo": {
"agentVersion": "1.22.0",
"agentHash": "26518174",
"dockerVersion": "DockerVersion: 18.06.1-ce"
},
"runningTasksCount": 1,
"attachments": []
}
]
}
但是,不,ECS容器实例不是AFAIK,而是容器本身。它们是配置为使用ECS运行容器的虚拟服务器。