简体   繁体   English

Kubernetes Django不允许的主机

[英]Kubernetes Django Disallowed Hosts

I'm trying to deploy a Django app via Kubernetes. 我正在尝试通过Kubernetes部署Django应用程序。 After creating my pod definition, LoadBalancer service, and routing DNS traffic to my LoadBalancer, I'm getting a Disallowed Hosts error . 创建我的Pod定义,LoadBalancer服务并将DNS流量路由到我的LoadBalancer之后,出现了Disallowed Hosts error

I think I need to add the name of the LoadBalancer to my allowed hosts, but how do I do that when the LoadBalancer is created when I run kubectl create -f service.yaml ? 我想我需要将LoadBalancer的名称添加到允许的主机上,但是当我运行kubectl create -f service.yaml时创建LoadBalancer时,该怎么办?

pod.yaml: pod.yaml:

apiVersion: v1
kind: Pod
metadata:
  name: test.example.com
  labels:
    app: my-pod
spec:
  containers:
  - name: my-container
    image: my-image:1.0
    ports:
    - name: my-port
      containerPort: 8000 

service.yaml service.yaml

apiVersion: v1
kind: Service
metadata:
  name: mgmt-service
spec:
  ports:
  - port: 80
    targetPort: mgmt-port
    protocol: TCP
  selector:
    app: mgmt_reporting
  type: LoadBalancer

So I needed to put the DNS name that I was routing traffic from into allowed hosts . 因此,我需要将用来路由流量的DNS名称放入allowed hosts The name of the LoadBalancer does not matter. LoadBalancer的名称无关紧要。

The DNS name is whatever you pointed at your load balancer. DNS名称是您指向负载均衡器的名称。 In my case, I created the DNS name app.kubernetes.mydomain.com Route53. 就我而言,我创建了DNS名称app.kubernetes.mydomain.com Route53。 This needs to go into allowed hosts 这需要进入allowed hosts

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM