Kubernetes build django+;uwsgi&x2B;连接到上游时,nginx显示失败(111:连接被拒绝)
当我创建my.yaml时,nginx在连接到上游时将显示失败(111:连接被拒绝) 你对此有什么建议吗?是否存在不连接的pod网络 uwsgi:Kubernetes build django+;uwsgi&x2B;连接到上游时,nginx显示失败(111:连接被拒绝),django,nginx,kubernetes,uwsgi,Django,Nginx,Kubernetes,Uwsgi,当我创建my.yaml时,nginx在连接到上游时将显示失败(111:连接被拒绝) 你对此有什么建议吗?是否存在不连接的pod网络 uwsgi: [uwsgi] module = myapp.wsgi master = true processes = 10 socket = 127.0.0.1:8001 chmod-socket = 777 vacuum = true enable-threads = True
[uwsgi]
module = myapp.wsgi
master = true
processes = 10
socket = 127.0.0.1:8001
chmod-socket = 777
vacuum = true
enable-threads = True
nginx:
upstream django_api {
server 127.0.0.1:8001 max_fails=20 fail_timeout=10s;
}
server {
listen 80;
#location /media {
# alias /media; # your Django project's media files - amend as required
#}
location /static {
alias /usr/share/apps/static; # your Django project's static files - amend as required
}
location / {
uwsgi_read_timeout 60;
uwsgi_pass django_api;
include ./uwsgi_params; # the uwsgi_params file you installed
uwsgi_param Host $host;
uwsgi_param X-Real-IP $remote_addr;
uwsgi_param X-Forwarded-For $proxy_add_x_forwarded_for;
uwsgi_param X-Forwarded-Proto $http_x_forwarded_proto;
}
}因此,请想一想,也许可以将您的uwsgi设置为
0.0.0:8001
,然后在您的podSpec上仅设置8001的容器端口值:
apiVersion: v1
kind: Pod
metadata:
name: mypod
labels:
component: web
spec:
containers:
- name: django
image: myimage
ports:
- containerPort: 8001
- name: nginx
image: nginx:alpine
....
这将使其在localhost:8001/127.0.0.1:8001中可用