为namespace添加App Mesh 相关的标签,并部署 Mesh 对象:
kubectl apply -f deployment/mesh.yaml
namespace/prodcatalog-ns configured
mesh.appmesh.k8s.aws/prodcatalog-mesh created
确认 Mesh 对象和 Namespace 已创建:
kubectl describe namespace prodcatalog-ns
Name: prodcatalog-ns
Labels: appmesh.k8s.aws/sidecarInjectorWebhook=enabled
gateway=ingress-gw
mesh=prodcatalog-mesh
Annotations: Status: Active
kubectl describe mesh prodcatalog-mesh
Status:
Conditions:
Last Transition Time: 2020-11-02T16:43:03Z
Status: True
Type: MeshActive
kubectl apply -f deployment/meshed_app.yaml
virtualnode.appmesh.k8s.aws/prodcatalog created
virtualservice.appmesh.k8s.aws/prodcatalog created
virtualservice.appmesh.k8s.aws/proddetail created
virtualrouter.appmesh.k8s.aws/proddetail-router created
virtualrouter.appmesh.k8s.aws/prodcatalog-router created
virtualnode.appmesh.k8s.aws/proddetail-v1 created
virtualnode.appmesh.k8s.aws/frontend-node created
virtualservice.appmesh.k8s.aws/frontend-node created
获取应用服务的所有 Meshed 资源,您应该会看到以下结果:
kubectl get virtualnode,virtualservice,virtualrouter -n prodcatalog-ns
NAME ARN AGE
virtualnode.appmesh.k8s.aws/frontend-node arn:aws:appmesh:us-west-2:$ACCOUNT_ID:mesh/prodcatalog-mesh/virtualNode/frontend-node_prodcatalog-ns 3m4s
virtualnode.appmesh.k8s.aws/prodcatalog arn:aws:appmesh:us-west-2:$ACCOUNT_ID:mesh/prodcatalog-mesh/virtualNode/prodcatalog_prodcatalog-ns 35m
virtualnode.appmesh.k8s.aws/proddetail-v1 arn:aws:appmesh:us-west-2:$ACCOUNT_ID:mesh/prodcatalog-mesh/virtualNode/proddetail-v1_prodcatalog-ns 35m
NAME ARN AGE
virtualservice.appmesh.k8s.aws/frontend-node arn:aws:appmesh:us-west-2:$ACCOUNT_ID:mesh/prodcatalog-mesh/virtualService/frontend-node.prodcatalog-ns.svc.cluster.local 3m4s
virtualservice.appmesh.k8s.aws/prodcatalog arn:aws:appmesh:us-west-2:$ACCOUNT_ID:mesh/prodcatalog-mesh/virtualService/prodcatalog.prodcatalog-ns.svc.cluster.local 35m
virtualservice.appmesh.k8s.aws/proddetail arn:aws:appmesh:us-west-2:$ACCOUNT_ID:mesh/prodcatalog-mesh/virtualService/proddetail.prodcatalog-ns.svc.cluster.local 35m
NAME ARN AGE
virtualrouter.appmesh.k8s.aws/prodcatalog-router arn:aws:appmesh:us-west-2:$ACCOUNT_ID:mesh/prodcatalog-mesh/virtualRouter/prodcatalog-router_prodcatalog-ns 35m
virtualrouter.appmesh.k8s.aws/proddetail-router arn:aws:appmesh:us-west-2:$ACCOUNT_ID:mesh/prodcatalog-mesh/virtualRouter/proddetail-router_prodcatalog-ns 35m