是,
您可以
namespace通过主机名从任何容器访问和通信。
这是有关Kubernetes
Service配置的示例:
---apiVersion: v1kind: Servicemetadata: name: master labels: name: master namespace: smart-officespec: ports: - port: 5672 name: master targetPort: 5672 selector: name: master
Deployment配置:
---apiVersion: extensions/v1beta1kind: Deploymentmetadata: name: master labels: name: master namespace: smart-officespec: replicas: 1 template: metadata: labels: name: master annotations: prometheus.io/scrape: "false" spec: containers: - name: master image: rabbitmq:3.6.8-management ports: - containerPort: 5672 name: master nodeSelector: beta.kubernetes.io/os: linux
并通过其他服务,例如,您
slaver
.env将:
AMQP_HOST=master <---- The hostnameAMQP_PORT=5672AMQP_USERNAME=guestAMQP_PASSWORD=guestAMQP_HEARTBEAT=60
即使您不发布外部IP,它也可以在群集中使用。
希望这可以帮到你。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)