kind: Service
apiVersion: v1
metadata:
name: new
namespace: coayufei
labels:
app: myapp
spec:
ports:
- name: tcp1
protocol: TCP
port: 15672
targetPort: 15672
- name: tcp2
protocol: TCP
port: 5672
targetPort: 5672
selector:
app: api
kind: Ingress
apiVersion: networking.k8s.io/v1beta1
metadata:
name: new
namespace: coayufei
labels:
app: myapp
spec:
tls:
- hosts:
- *DOMAIN
secretName: new-ingress
rules:
- host: *DOMAIN
http:
paths:
- backend:
serviceName: new
servicePort: 15672
- 通过 DOMAIN 可以访问到 RabbitMQ WEB 界面 API 也可以访问
PYTHON
url = os.environ.get('CLOUDAMQP_URL',
'amqp://guest:guest@DOMAIN/guest')
params = pika.URLParameters(url)
connection = pika.BlockingConnection(params)
怎么把 5672 开放到公网上