Amazon web services 无法使用虚拟kubelet在AWS Fargate上创建nginx任务定义的部署
我无法使用虚拟kubelet将使用kubectl的nginx容器部署到AWS Fargate。我遵循以下指南:。 我在步骤6:创建Kubernetes对象时遇到问题。 我想知道为什么nginx容器挂起,为什么还没有创建AWS Fargate任务定义 下面是我使用的一些命令。我可以根据要求提供更多细节Amazon web services 无法使用虚拟kubelet在AWS Fargate上创建nginx任务定义的部署,amazon-web-services,docker,kubernetes,kubectl,aws-fargate,Amazon Web Services,Docker,Kubernetes,Kubectl,Aws Fargate,我无法使用虚拟kubelet将使用kubectl的nginx容器部署到AWS Fargate。我遵循以下指南:。 我在步骤6:创建Kubernetes对象时遇到问题。 我想知道为什么nginx容器挂起,为什么还没有创建AWS Fargate任务定义 下面是我使用的一些命令。我可以根据要求提供更多细节 # ./virtual-kubelet --provider aws --provider-config fargate.toml ... 2019/05/16 06:50:24 Received
# ./virtual-kubelet --provider aws --provider-config fargate.toml
...
2019/05/16 06:50:24 Received NodeDaemonEndpoints request.
ERRO[0000] TLS certificates not provided, not setting up pod http server certPath= keyPath= node=virtual-kubelet operatingSystem=Linux provider=aws watchedNamespace=
INFO[0000] Initialized node=virtual-kubelet operatingSystem=Linux provider=aws watchedNamespace=
INFO[0000] Created node node=virtual-kubelet operatingSystem=Linux provider=aws watchedNamespace=
INFO[0000] Node leases not supported, falling back to only node status updates node=virtual-kubelet operatingSystem=Linux provider=aws watchedNamespace=
INFO[0000] Pod cache in-sync node=virtual-kubelet operatingSystem=Linux provider=aws watchedNamespace=
2019/05/16 06:50:25 Received GetPods request.
2019/05/16 06:50:25 Responding to GetPods: [].
INFO[0000] starting workers node=virtual-kubelet operatingSystem=Linux provider=aws watchedNamespace=
INFO[0000] started workers node=virtual-kubelet operatingSystem=Linux provider=aws watchedNamespace=
更新:
然后,我对每个节点运行以下命令,将nodeSelector添加到我的节点:
kubectl label nodes ip-172-20-47-15.eu-west-2.compute.internal type=virtual-kubelet
type=virtual kubelet是清单文件nginx-deployment.yaml中指定的节点选择器
# kubectl get pods -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
nginx-deployment-c6695csfc-5f7bh 1/1 Running 0 4m59s 100.96.2.7 ip-172-20-47-242.eu-west-2.compute.internal <none> <none>
nginx-deployment-c6695csfc-bwfb8 1/1 Running 0 4m59s 100.96.1.6 ip-172-20-59-102.eu-west-2.compute.internal <none> <none>
nginx-deployment-c6695csfc-mcfvw 1/1 Running 0 4m59s 100.96.2.8 ip-172-20-47-242.eu-west-2.compute.internal <none>
#kubectl获得吊舱-o宽
名称就绪状态重新启动老化IP节点指定节点就绪门
nginx-deployment-c6695csfc-5f7bh 1/1运行0 4m59s 100.96.2.7 ip-172-20-47-242.eu-west-2.compute.internal
nginx-deployment-c6695csfc-bwfb8 1/1运行0 4m59s 100.96.1.6 ip-172-20-59-102.eu-west-2.compute.internal
nginx-deployment-c6695csfc-mcfvw 1/1运行0 4m59s 100.96.2.8 ip-172-20-47-242.eu-west-2.compute.internal
现在,当我转到AWS Fargate仪表板时,相关的任务定义不会如教程中所示创建。此问题已解决。我能够通过将ALB安全组添加到Fargate.toml文件中,并通过向nginx.deployment.yaml文件中添加容差来创建AWS Fargate定义,如下所示:
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.7.9
tolerations:
- key: virtual-kubelet.io/provider
operator: Equal
value: azure
effect: NoSchedule
# kubectl get pods -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
nginx-deployment-c6695csfc-5f7bh 0/1 Pending 0 21m <none> <none> <none> <none>
nginx-deployment-c6695csfc-bwfb8 0/1 Pending 0 21m <none> <none> <none> <none>
nginx-deployment-c6695csfc-mcfvw 0/1 Pending 0 21m <none> <none> <none> <none>
# kubectl describe pod nginx-deployment-c6695csfc-5f7bh
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning FailedScheduling 2m11s (x191 over 22m) default-scheduler 0/4 nodes are available: 1 Insufficient cpu, 1 node(s) had taints that the pod didn't tolerate, 3 node(s) didn't match node selector.
kubectl label nodes ip-172-20-47-15.eu-west-2.compute.internal type=virtual-kubelet
# kubectl get pods -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
nginx-deployment-c6695csfc-5f7bh 1/1 Running 0 4m59s 100.96.2.7 ip-172-20-47-242.eu-west-2.compute.internal <none> <none>
nginx-deployment-c6695csfc-bwfb8 1/1 Running 0 4m59s 100.96.1.6 ip-172-20-59-102.eu-west-2.compute.internal <none> <none>
nginx-deployment-c6695csfc-mcfvw 1/1 Running 0 4m59s 100.96.2.8 ip-172-20-47-242.eu-west-2.compute.internal <none>
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.7.9
tolerations:
- key: virtual-kubelet.io/provider
operator: Equal
value: azure
effect: NoSchedule