请注意,WorkloadEntry 和 ServiceEntry 在未来最终将自动创建 。
在
$VM_NAMESPACE
中创建服务条目资源 。
kubectl apply -n ${VM_NAMESPACE} -f serviceentry.yaml
我们现在可以使用 Kubernetes 服务名称
hello-vm.vm-namespace
来访问虚拟机上的工作负载 。让我们在集群内运行一个 Pod,并尝试从那里访问该服务:
$ kubectl run curl --image=radial/busyboxplus:curl -i --tty If you don't see a command prompt, try pressing enter. [ root@curl:/ ]$
在你得到 Pod 中的命令提示后,你可以运行 curl 并访问工作负载 。你应该看到一个目录列表的响应 。同样地,你会注意到在 HTTP 服务器运行的实例上有一个日志条目:
[ root@curl:/ ]$ curl hello-vm.vm-namespace <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dt d"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Directory listing for /</title> </head> <body> <h1>Directory listing for /</h1> <hr> ...
经验总结扩展阅读
-
2023年12月17日适合剃头吗 2023年12月剃头吉日一览表
-
-
-
洗面奶 “洗面奶”查出致癌物!你的日用款上黑名单了吗?
-
-
-
-
-
-
紫薇命盘,2020年2月7日——正月十四适合什么属相的人结婚?
-
-
-
领蔚生物|干细胞是肺纤维化的“清道夫”,是肺损伤患者的福音
-
-
-
-
-
-
洗护品|别再瞧不起“国货”了,这款国货洗护品,别看价格低,却真心好用
-