shaowenchen
如果不 swap
curl http://ks-apiserver.kubesphere-system.svc/kapis/resources.kubesphere.io/v1alpha3/deployments
可以访问通
➜ ~ telepresence --run-shell
T: Using a Pod instead of a Deployment for the Telepresence proxy. If you experience problems, please file
T: an issue!
T: Set the environment variable TELEPRESENCE_USE_DEPLOYMENT to any non-empty value to force the old
T: behavior, e.g.,
T: env TELEPRESENCE_USE_DEPLOYMENT=1 telepresence --run curl hello
T: Starting proxy with method 'vpn-tcp', which has the following limitations: All processes are affected,
T: only one telepresence can run per machine, and you can't use other VPNs. You may need to add cloud hosts
T: and headless services with --also-proxy. For a full list of method limitations see
T: https://telepresence.io/reference/methods.html
T: Volumes are rooted at $TELEPRESENCE_ROOT. See https://telepresence.io/howto/volumes.html for details.
T: Starting network proxy to cluster using new Pod telepresence-1609728959-952586-80478
T: No traffic is being forwarded from the remote Deployment to your local machine. You can use the --expose
T: option to specify which ports you want to forward.
T: Connected. Flushing DNS cache.
T: Setup complete. Launching your command.
The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
@minikube|bash-3.2$ curl http://ks-apiserver.kubesphere.system.svc/kapis/resources.kubesphere.io/v1alpha3/deployments
curl: (6) Could not resolve host: ks-apiserver.kubesphere.system.svc
@minikube|bash-3.2$ curl http://ks-apiserver.kubesphere-system.svc/kapis/resources.kubesphere.io/v1alpha3/deployments
{
"kind": "Status",
"apiVersion": "v1",
"metadata": {
},
"status": "Failure",
"message": "deployments.resources.kubesphere.io is forbidden: User \"system:anonymous\" cannot list resource \"deployments\" in API group \"resources.kubesphere.io\" at the cluster scope",
"reason": "Forbidden",
"details": {
"group": "resources.kubesphere.io",
"kind": "deployments"
},
"code": 403
}@minikube|bash-3.2$
swap 之后 本地开启 ks-apiserver
curl http://ks-apiserver.kubesphere-system.svc/kapis/resources.kubesphere.io/v1alpha3/deployments
访问不了了
➜ ~ telepresence --namespace kubesphere-system --swap-deployment ks-apiserver --also-proxy redis.kubesphere-system.svc --also-proxy openldap.kubesphere-system.svc --expose 9090:9090
T: Using a Pod instead of a Deployment for the Telepresence proxy. If you experience problems, please file
T: an issue!
T: Set the environment variable TELEPRESENCE_USE_DEPLOYMENT to any non-empty value to force the old
T: behavior, e.g.,
T: env TELEPRESENCE_USE_DEPLOYMENT=1 telepresence --run curl hello
T: Starting proxy with method 'vpn-tcp', which has the following limitations: All processes are affected,
T: only one telepresence can run per machine, and you can't use other VPNs. You may need to add cloud hosts
T: and headless services with --also-proxy. For a full list of method limitations see
T: https://telepresence.io/reference/methods.html
T: Volumes are rooted at $TELEPRESENCE_ROOT. See https://telepresence.io/howto/volumes.html for details.
T: Starting network proxy to cluster by swapping out Deployment ks-apiserver with a proxy Pod
T: Forwarding remote port 9090 to local port 9090.
T: Connected. Flushing DNS cache.
T: Setup complete. Launching your command.
The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
@minikube|bash-3.2$ curl http://ks-apiserver.kubesphere-system.svc/kapis/resources.kubesphere.io/v1alpha3/deployments
curl: (52) Empty reply from server
dig 可以查询到对应的 ip
@minikube|bash-3.2$ dig ks-apiserver.kubesphere-system.svc
; <<>> DiG 9.10.6 <<>> ks-apiserver.kubesphere-system.svc
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 24024
;; flags: qr aa ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;ks-apiserver.kubesphere-system.svc. IN A
;; ANSWER SECTION:
ks-apiserver.kubesphere-system.svc. 2 IN A 10.109.170.53
;; Query time: 5 msec
;; SERVER: 172.16.100.5#53(172.16.100.5)
;; WHEN: Mon Jan 04 11:03:36 CST 2021
;; MSG SIZE rcvd: 68
@minikube|bash-3.2$ kubectl get svc -n kubesphere-system -o wide
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR
ks-apiserver ClusterIP 10.109.170.53 <none> 80/TCP 17h app=ks-apiserver,tier=backend,version=v3.0.0
ks-console NodePort 10.98.249.140 <none> 80:30880/TCP 17h app=ks-console,tier=frontend,version=v3.0.0
ks-controller-manager ClusterIP 10.103.228.240 <none> 443/TCP 17h app=ks-controller-manager,tier=backend,version=v3.0.0
openldap ClusterIP None <none> 389/TCP 17h app.kubernetes.io/instance=ks-openldap,app.kubernetes.io/name=openldap-ha
redis ClusterIP 10.107.83.108 <none> 6379/TCP 17h app=redis,tier=database