我正在尝试在minikube中创建一个入口。我已经启用了入口添加并检查了所有相关服务,并且已经添加了pod并且正在运行。
当我创建入口时,我将其指向与入口位于同一名称空间的service.NodePort。但是,当我描述入口时,后端IP地址为<none>
这是我的部署yaml
apiVersion: v1
kind: Namespace
metadata:
name: proxy
labels:
name: proxy
---
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: deployment
namespace: proxy
labels:
app: proxy
spec:
replicas: 1
template:
metadata:
labels:
app: proxy
spec:
containers:
- name: proxy
image: wildapplications/proxy:latest
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
imagePullSecrets:
- name: regsecret
---
apiVersion: v1
kind: Service
metadata:
name: service
namespace: proxy
spec:
type: NodePort
ports:
- port: 8080
targetPort: 8080
selector:
app: proxy
externalName: proxy
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: ingress
namespace: proxy
annotations:
ingress.kubernetes.io/rewrite-target: /
spec:
rules:
- host: echo.example.com
http:
paths:
- path: /test
backend:
serviceName: service
servicePort: 8080
当我描述我得到的入口时
Name: ingress
Namespace: proxy
Address: 192.168.99.100
Default backend: default-http-backend:80 (172.17.0.14:8080)
Rules:
Host Path Backends
---- ---- --------
echo.example.com
/test service:8080 (<none>)
Annotations:
rewrite-target: /
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal CREATE 16m ingress-controller Ingress proxy/ingress
Normal CREATE 15m ingress-controller Ingress proxy/ingress
Normal UPDATE 15m ingress-controller Ingress proxy/ingress
为什么入口无法解析为其上方直接创建的服务指定的后端,有什么明显的明显之处吗?
答案 0 :(得分:1)
我找到了我的问题的解决方案,所以我发布以防其他人遇到类似的事情。
我试图通过我的minikube ip地址( typealias Indexed = (num: Int, index: Int)
class Buffer {
let ordered = PublishSubject<Int>()
private var current = 0
private var buffer: [Int: Int] = [:]
func onNext(_ indexed: Indexed) {
self.buffer[indexed.index] = indexed.num
for index in self.buffer.keys.sorted() {
if index == current {
ordered.onNext(self.buffer[index]!)
self.buffer.remove(at: self.buffer.index(forKey: index)!)
current += 1
}
}
}
}
let buffer = Buffer()
buffer
.ordered
.subscribe(onNext: { num in
print("aaab done \(num)")
})
.disposed(by: disposeBag)
persistMessageEventBus
.mapWithIndex { (num, index) -> Indexed in
return (num: num, index: index)
}
.flatMap({ indexed -> Observable<Indexed> in
print("aaab Doing \(indexed.num)")
let t2g = Observable.just(indexed).delay(Double(indexed.num), scheduler: MainScheduler.instance).do(onNext: { indexed in print("aaab Done async \(indexed.num)") })
return t2g
})
.subscribe(onNext: { indexed in
buffer.onNext(indexed)
})
.disposed(by: disposeBag)
persistMessageEventBus.onNext(2)
persistMessageEventBus.onNext(4)
persistMessageEventBus.onNext(1)
来获取ip)来访问入口,这提供了404,因为我没有使用主机导航到它。
解决我执行的404
minikube ip
然后从浏览器导航到主机网址。