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

使用nodeport暴露端口,访问后登录时报错 #110

Open
cll011 opened this issue Mar 4, 2019 · 1 comment
Open

使用nodeport暴露端口,访问后登录时报错 #110

cll011 opened this issue Mar 4, 2019 · 1 comment
Assignees

Comments

@cll011
Copy link

cll011 commented Mar 4, 2019

Describe the bug
按照github上的步骤进行端口转发失败后,使用nodeport暴露端口,访问后登录时报错。

To Reproduce
想试一下naftis的功能,但是到这一步,一直访问不了,想请大佬们指导指导。
Steps :

  1. 端口转发失败后,我修改了naftis.yaml,将LoadBalance改为了NodePort,然后replace naftis.yaml;
  2. 之后就执行暴露端口的命令:
    NAFTIIS_NODEPORT=$(kubectl get svc naftis-ui -n naftis -o jsonpath='{.spec.ports[0].nodePort}')
    INGRESS_HOST=$(kubectl get node -o jsonpath='{.items[0].status.addresses[0].address}')
    echo "http://$INGRESS_HOST:$NAFTIIS_NODEPORT/naftis-ui/"
  3. 执行后,输出地址:http://192.168.217.100:30326/naftis-ui/,然后用google浏览器访问;
  4. 访问后出现了naftis的登录页面,输入初始用户名admin和密码admin后,右上角出现:Notification
    app.common.errOthers(405)!
    错误页面截图如下:
    image
    想请大佬们帮我看一下,端口暴露的方式是否正确,为什么不可以端口转发?
@cll011
Copy link
Author

cll011 commented Mar 6, 2019

最后还是选择端口转发的方式,由于我是使用物理机访问虚拟机,所以需要用nginx作反向代理,安装文档中提到了这部分,我没有仔细看,我的错。
解决步骤:

  1. 首先要在centos上安装好nginx,然后需改nginx.conf文件,修改如下:
    image
  2. 执行 nginx -t 查看没有报错后,再进行下一步;
  3. 端口转发访问Naftis

kubectl -n naftis port-forward $(kubectl -n naftis get pod -l app=naftis-ui -o jsonpath='{.items[0].metadata.name}') 8080:80 &
4. 打开浏览器,访问http://虚拟机IP/index.html,登录用户名和密码均为admin

@sevennt sevennt self-assigned this Mar 7, 2019
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

2 participants