kubesphere / tower Goto Github PK
View Code? Open in Web Editor NEWProxy for multiple Kubernetes cluster communication
License: Apache License 2.0
Proxy for multiple Kubernetes cluster communication
License: Apache License 2.0
tower有自动更新机制嘛,通过平台ks更新、或者自动更新
tower:
E1118 17:18:08.550844 1 proxy.go:152] Failed to upgrade connectionwrite tcp 10.233.90.20:8080->10.233.97.0:61511: write: connection reset by peer
agent:
agent.go:168] Connection error: websocket: bad handshake (Attempt: 18)
How many member clusters can Kubesphere federation support through tower agent?
run agen
./bin/agent --kubeconfig ~/.kube/config --kubesphere-service http://0.0.0.0:8000 --token 13530761f40fc3161ed59316a6b3ed7b6ba44c5cca613f03d37db3fe9d903e87 --name alpha --v 4 --proxy-server http://192.168.1.31:30880
http://0.0.0.0:8000
是本地的一个python文件服务 (python3 -m http.server
)
集群pod内访问代理的80端口, proxy panic,
日志:
http: panic serving 10.233.124.47:41500: runtime error: invalid memory address or nil pointer dereference
goroutine 588 [running]:
net/http.(*conn).serve.func1(0xc000238280)
/usr/local/go/src/net/http/server.go:1795 +0x139
panic(0x13594c0, 0x208c260)
/usr/local/go/src/runtime/panic.go:679 +0x1b2
k8s.io/apimachinery/pkg/util/proxy.normalizeLocation(0xc000017b88, 0x20c5d60)
/go/pkg/mod/k8s.io/[email protected]/pkg/util/proxy/upgradeaware.go:168 +0x48
k8s.io/apimachinery/pkg/util/proxy.NewUpgradeAwareHandler(...)
/go/pkg/mod/k8s.io/[email protected]/pkg/util/proxy/upgradeaware.go:178
kubesphere.io/tower/pkg/proxy.(*Server).ServeHTTP(0xc000337b00, 0x16d7f80, 0xc00012a700, 0xc000260c00)
/workspace/pkg/proxy/proxy_server.go:184 +0x28b
net/http.serverHandler.ServeHTTP(0xc0002aa380, 0x16d7f80, 0xc00012a700, 0xc000260c00)
/usr/local/go/src/net/http/server.go:2831 +0xa4
net/http.(*conn).serve(0xc000238280, 0x16dbc40, 0xc0000a6dc0)
/usr/local/go/src/net/http/server.go:1919 +0x875
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:2957 +0x384
2023/05/16 02:43:18 http: panic serving 172.64.182.254:59840: runtime error: invalid memory address or nil pointer dereference
goroutine 58308 [running]:
net/http.(*conn).serve.func1(0xc000186e60)
/usr/local/go/src/net/http/server.go:1795 +0x139
panic(0x13594c0, 0x208c260)
/usr/local/go/src/runtime/panic.go:679 +0x1b2
bufio.(*Writer).Flush(0xc00290c3c0, 0x16a6d20, 0xc00290c3c0)
/usr/local/go/src/bufio/bufio.go:593 +0x5c
net/http.(*Request).write(0xc001908e00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/net/http/request.go:691 +0x7bb
net/http.(*Request).Write(...)
/usr/local/go/src/net/http/request.go:524
k8s.io/apimachinery/pkg/util/proxy.dial(0xc001908e00, 0x16a84c0, 0xc00027a280, 0xc0003af160, 0xc0003aefe0, 0xc000fd7a60, 0x14efb96)
/go/pkg/mod/k8s.io/[email protected]/pkg/util/proxy/upgradeaware.go:428 +0x165
k8s.io/apimachinery/pkg/util/proxy.(*UpgradeAwareHandler).DialForUpgrade(0xc00335a5a0, 0xc001908e00, 0x890575e8, 0xffffffffffffffff, 0x0, 0x3e0000c002b22fa8)
/go/pkg/mod/k8s.io/[email protected]/pkg/util/proxy/upgradeaware.go:399 +0x11b
k8s.io/apimachinery/pkg/util/proxy.(*UpgradeAwareHandler).tryUpgrade(0xc00335a5a0, 0x16d7f80, 0xc002af42a0, 0xc001908c00, 0x5f9f00)
/go/pkg/mod/k8s.io/[email protected]/pkg/util/proxy/upgradeaware.go:280 +0x15ea
k8s.io/apimachinery/pkg/util/proxy.(*UpgradeAwareHandler).ServeHTTP(0xc00335a5a0, 0x16d7f80, 0xc002af42a0, 0xc001908c00)
/go/pkg/mod/k8s.io/[email protected]/pkg/util/proxy/upgradeaware.go:189 +0x6a
kubesphere.io/tower/pkg/proxy.(*Server).ServeHTTP(0xc0006da120, 0x16d7f80, 0xc002af42a0, 0xc001908c00)
/workspace/pkg/proxy/proxy_server.go:186 +0x355
net/http.serverHandler.ServeHTTP(0xc0000288c0, 0x16d7f80, 0xc002af42a0, 0xc001908c00)
/usr/local/go/src/net/http/server.go:2831 +0xa4
net/http.(*conn).serve(0xc000186e60, 0x16dbc40, 0xc001c9af40)
/usr/local/go/src/net/http/server.go:1919 +0x875
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:2957 +0x384
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x50 pc=0x63bc15]
goroutine 82318 [running]:
crypto/tls.(*Conn).write(0xc001523180, 0xc0009ba300, 0xf3, 0x100, 0xc000460300, 0xee, 0x180)
/usr/local/go/src/crypto/tls/conn.go:915 +0x135
crypto/tls.(*Conn).writeRecordLocked(0xc001523180, 0x16, 0xc000460300, 0xee, 0x180, 0x0, 0x0, 0xc000460300)
/usr/local/go/src/crypto/tls/conn.go:964 +0x29f
crypto/tls.(*Conn).writeRecord(0xc001523180, 0xc000460316, 0xc000460300, 0xee, 0x180, 0x0, 0x0, 0x0)
/usr/local/go/src/crypto/tls/conn.go:986 +0xe2
crypto/tls.(*Conn).clientHandshake(0xc001523180, 0x0, 0x0)
/usr/local/go/src/crypto/tls/handshake_client.go:167 +0x179
crypto/tls.(*Conn).Handshake(0xc001523180, 0x0, 0x0)
/usr/local/go/src/crypto/tls/conn.go:1362 +0x12b
net/http.(*persistConn).addTLS.func2(0x0, 0xc001523180, 0x0, 0xc0005dcf00)
/usr/local/go/src/net/http/transport.go:1414 +0x42
created by net/http.(*persistConn).addTLS
/usr/local/go/src/net/http/transport.go:1410 +0x1aa
主集群节点上的tower pod报错如下,网络均没有任何问题,但是经常出现,等待2分钟左右又恢复了,
E0115 01:46:14.038945 1 upgradeaware.go:367] Error proxying data from client to backend: read tcp 10.233.78.199:16614->10.233.78.138:48506: read: connection reset by peer
E0115 01:46:14.040117 1 upgradeaware.go:367] Error proxying data from client to backend: read tcp 10.233.78.199:16614->10.233.78.138:48472: read: connection reset by peer
I found that the project uses a custom ssh-based protocol, would it be interesting to replace it with one that is compatible with OpenSSH?
https://github.com/wzshiming/sshproxy
https://github.com/wzshiming/sshd
Proxy(at least two replications):
Add leader election and kubernetes readiness probe. They both make sure that there are only one proxy running and one endpoint behind the svc. Once one proxy replication is down, another one can start quickly.
Agent(at least two replications):
Add leader election to make sure that there is only one agent running, once one agent replication is down, another one can become the leader quickly.
how can i use postman to test tower-server api ?
➜ tower git:(master) ✗ kubectl -n kubesphere-system get cluster alpha -o jsonpath='{.spec.connection.kubeconfig}' | base64 -d > config_alpha
➜ tower git:(master) ✗ kubectl --kubeconfig config_alpha get node
Unable to connect to the server: dial tcp 10.100.231.111:6443: i/o timeout
➜ tower git:(master) ✗ kubectl --kubeconfig config_alpha get node
Unable to connect to the server: dial tcp 10.100.231.111:6443: i/o timeout
➜ tower git:(master) ✗ kubectl --kubeconfig config_alpha get node
Unable to connect to the server: dial tcp 10.100.231.111:6443: i/o timeout
➜ tower git:(master) ✗ kubectl --kubeconfig config_alpha get node
Unable to connect to the server: dial tcp 10.100.231.111:6443: i/o timeout
➜ tower git:(master) ✗ kubectl --kubeconfig config_alpha get node
Unable to connect to the server: dial tcp 10.100.231.111:6443: i/o timeout
➜ tower git:(master) ✗ kubectl --kubeconfig config_alpha get node
Unable to connect to the server: dial tcp 10.100.231.111:6443: i/o timeout
apiVersion: v1
clusters:
src kubectl get all -n kubesphere-system
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/mc-alpha ClusterIP 10.100.231.111 6443/TCP,80/TCP 47m
➜ src
kubectl get cluster alpha -oyaml -n kubesphere-system
apiVersion: cluster.kubesphere.io/v1alpha1
kind: Cluster
metadata:
creationTimestamp: "2022-05-31T07:00:04Z"
generation: 11
managedFields:
When executing kubectl rollout restart -n kubesphere-system deployment cluster-agent
, the status of the new pod is CrashLoopBackOff
and get logs like A session already allocated for this client
. We should retry to connect the server instead of just pending.
If there is a docker mirror cache, printing out the build date and version is good for debugging
tower/.github/workflows/go.yml
Lines 56 to 57 in 786fdd1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.