问题描述
我正在尝试使用Kubernetes在高山Linux上设置Nginx服务器。 我配置了.conf文件和负载平衡器(MetalLB)。 问题是,当我尝试连接loadBalancer提供的IP地址时,连接失败。
当我尝试卷曲相同的IP时,这是消息错误:
function handleSubmit(e) {
e.preventDefault()
const {username,password } = e.target.elements
console.log({username: username.value,password: password.value })
}
<form onSubmit={handleSubmit}>
<input type="text" id="username"/>
<input type="text" id="password"/>
<input type="submit" value="Login" />
</form>
我不知道为什么这行不通。 这是我的Nginx .conf文件:
curl: (7) Failed to connect to 192.168.99.1 port 80: Connection refused
我的Nginx yaml:
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
root /var/www/localhost/htdocs;
index index.html;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
server_name default_name;
ssl_certificate /etc/nginx/certificate;
ssl_certificate_key /etc/nginx/server.key;
root /var/www/localhost/htdocs;
index index.html index.htm index.nginx-debian.html index.php;
autoindex on;
}
还有我的MetalLB的Yaml:
apiVersion: apps/v1
kind: Deployment
metadata:
name: container-nginx
labels:
app: nginx
spec:
selector:
matchLabels:
app: nginx
replicas: 1
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: image-nginx
imagePullPolicy: Never
ports:
- containerPort: 80
- containerPort: 443
---
apiVersion: v1
kind: Service
metadata:
name: nginx
spec:
type: LoadBalancer
selector:
app: nginx
ports:
- protocol: TCP
port: 80
targetPort: 80
name: http
- protocol: TCP
port: 443
name: https
targetPort: 443
有人知道出什么问题了吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)