我阅读了AmazonECS文档和this文章,其中给出了每个术语的基本解释,包括:
容器实例 - 这只是EC2实例,它是ECS群集的一部分,并且在其上运行了docker和ecs-agent。
我感到有点困惑。我认为每个task
都是container
,它运行在EC2 instance
上,这是ECS
集群的一部分。那么为什么EC2 instance
被称为那样呢?或者EC2 instance
也是container
,我错过了什么?
当您考虑容器实例时,请考虑:
配置为通过具有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运行容器的虚拟服务器。