Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] 使用nginx代理kubepi后,用post接口调用创建集群成员出现502,服务报错 #193

Closed
xudingjun3131 opened this issue Mar 14, 2024 · 2 comments
Assignees

Comments

@xudingjun3131
Copy link

xudingjun3131 commented Mar 14, 2024

KubePi 版本
1.7.0

Kubernetes 版本
1.23.17

Bug 描述
使用nginx代理kubepi后,用post接口调用创建集群成员出现502,服务报错

Bug 重现步骤(有截图更好)
1:使用postman调用记录
image

2: kubepi服务报错

[HTTP Server] http: panic serving 192.168.0.140:56882: interface conversion: interface {} is nil, not *session.UserProfile
goroutine 138687 [running]:
net/http.(*conn).serve.func1()
net/http/server.go:1854 +0xbf
panic({0x227f3c0, 0xc002670270})
runtime/panic.go:890 +0x263
github.com/KubeOperator/kubepi/internal/api/v1.authHandler.func1(0xc002b4e000)
github.com/KubeOperator/kubepi/internal/api/v1/v1.go:61 +0x254
github.com/kataras/iris/v12/context.(*Context).Next(0xc001d004d0?)
github.com/kataras/iris/v12@v12.2.1/context/context.go:683 +0x58
github.com/KubeOperator/kubepi/internal/api/v1.WarpedJwtHandler.func2(0x2598c40?)
github.com/KubeOperator/kubepi/internal/api/v1/v1.go:412 +0x5b
github.com/kataras/iris/v12/context.(*Context).Next(0xc002b4e000?)
github.com/kataras/iris/v12@v12.2.1/context/context.go:683 +0x58
github.com/KubeOperator/kubepi/internal/api/v1.pageHandler.func1(0xc002b4e000)
github.com/KubeOperator/kubepi/internal/api/v1/v1.go:108 +0x113
github.com/kataras/iris/v12/context.(*Context).Next(0xc002b4e040?)
github.com/kataras/iris/v12@v12.2.1/context/context.go:683 +0x58
github.com/KubeOperator/kubepi/internal/api/v1.langHandler.func1(0xc002b4e000)
github.com/KubeOperator/kubepi/internal/api/v1/v1.go:86 +0x12c
github.com/kataras/iris/v12/context.(*Context).Next(0x2816344149bc6?)
github.com/kataras/iris/v12@v12.2.1/context/context.go:683 +0x58
github.com/KubeOperator/kubepi/internal/server.(*KubePiServer).setResultHandler.func1(0xc002b4e000)
github.com/KubeOperator/kubepi/internal/server/server.go:163 +0x25
github.com/kataras/iris/v12/context.(*Context).Next(0xc002b4e040?)
github.com/kataras/iris/v12@v12.2.1/context/context.go:683 +0x58
github.com/kataras/iris/v12/sessions.(*Sessions).Handler.func1(0xc002b4e000)
github.com/kataras/iris/v12@v12.2.1/sessions/sessions.go:187 +0x7a
github.com/kataras/iris/v12/context.(*Context).Do(...)
github.com/kataras/iris/v12@v12.2.1/context/context.go:531
github.com/kataras/iris/v12/core/router.(*routerHandler).HandleRequest(0xc001dcd020, 0xc002b4e000)
github.com/kataras/iris/v12@v12.2.1/core/router/handler.go:465 +0x3b3
github.com/kataras/iris/v12/core/router.(*Router).buildMainHandler.func1({0x5094160?, 0xc002cc8000?}, 0xc0021f8ad0?)
github.com/kataras/iris/v12@v12.2.1/core/router/router.go:103 +0x63
github.com/kataras/iris/v12/core/router.(*Router).ServeHTTP(0x0?, {0x5094160?, 0xc002cc8000?}, 0x75bc94?)
github.com/kataras/iris/v12@v12.2.1/core/router/router.go:343 +0x30
net/http.serverHandler.ServeHTTP({0x5083be0?}, {0x5094160, 0xc002cc8000}, 0xc000638000)
net/http/server.go:2936 +0x316
net/http.(*conn).serve(0xc003f28000, {0x5095a58, 0xc001e77650})
net/http/server.go:1995 +0x612
created by net/http.(*Server).Serve
net/http/server.go:3089 +0x5ed

3: nginx.conf

upstream kube {
server 10.12.10.6:8088;
}

server {
listen 80;
server_name kube.xxxx.net;
return 301 https://$server_name$request_uri;
}

server {
listen 443 ssl;
server_name kube.xxxx.net;
ssl_certificate /etc/nginx/ssl/cert.crt;
ssl_certificate_key /etc/nginx/ssl/key.key;
client_max_body_size 2048M;
proxy_buffering off;
location / {
proxy_pass http://kube;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_read_timeout 3600;
}
location /kubepi/api/v1/ws {
proxy_pass http://kube;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_read_timeout 3600;
}
location /kubepi/webkubectl/rootws {
proxy_pass http://kube;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_read_timeout 3600;
}

}

@shaxiaozz
Copy link

我测试正常 @xudingjun3131

@xudingjun3131
Copy link
Author

it maybe my network issue.
close it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants