From 2b596fc22f3dbe1eb0214027710c176d86c7734b Mon Sep 17 00:00:00 2001 From: duanyingluo Date: Thu, 13 Feb 2020 23:16:18 +0800 Subject: [PATCH 1/4] Tomcat 9 --- docs/zh-cn/quickstart.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/zh-cn/quickstart.md b/docs/zh-cn/quickstart.md index 00d9661..bb807f0 100644 --- a/docs/zh-cn/quickstart.md +++ b/docs/zh-cn/quickstart.md @@ -1,11 +1,11 @@ # 快速开始 -这里,我们通过一个简单的示例,来体验KT的主要能力。 这里我们会在集群中部署一个Tomcat:7的镜像,并且通过KT直接在本地访问该服务,同时也可以将集群中所有原本对该应用的请求转发到本地。 +这里,我们通过一个简单的示例,来体验KT的主要能力。 这里我们会在集群中部署一个Tomcat:9的镜像,并且通过KT直接在本地访问该服务,同时也可以将集群中所有原本对该应用的请求转发到本地。 ## 部署实例应用 ``` shell -$ kubectl run tomcat --image=tomcat:7 --expose --port=8080 +$ kubectl run tomcat --image=tomcat:9 --expose --port=8080 kubectl run --generator=deployment/apps.v1 is DEPRECATED and will be removed in a future version. Use kubectl run --generator=run-pod/v1 or kubectl create instead. service/tomcat created deployment.apps/tomcat created From ca4c5128db18cc5bd0f9e5798a8b642042ce7939 Mon Sep 17 00:00:00 2001 From: duanyingluo Date: Thu, 13 Feb 2020 23:27:36 +0800 Subject: [PATCH 2/4] Tomcat 9 --- README.md | 2 +- docs/en-us/quickstart.md | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8a79831..bed0d7f 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ You can download and install the ktctl from [Downloads And Install](https://rdc- ### Deploy a service in Kubernetes ``` -$ kubectl run tomcat --image=tomcat:7 --expose --port=8080 +$ kubectl run tomcat --image=tomcat:9 --expose --port=8080 kubectl run --generator=deployment/apps.v1 is DEPRECATED and will be removed in a future version. Use kubectl run --generator=run-pod/v1 or kubectl create instead. service/tomcat created deployment.apps/tomcat created diff --git a/docs/en-us/quickstart.md b/docs/en-us/quickstart.md index 5a1a226..2d9a31e 100644 --- a/docs/en-us/quickstart.md +++ b/docs/en-us/quickstart.md @@ -1,11 +1,11 @@ # Quick Start Guide -In this chapter, we will deployment a sample app(tomcat:7) in Kubernetes cluster. With Kt to access the app from user labtop or exchange the request to user labtop. +In this chapter, we will deployment a sample app(tomcat:9) in Kubernetes cluster. With Kt to access the app from user labtop or exchange the request to user labtop. ## Create a Demo APP in Cluster ``` shell -$ kubectl run tomcat --image=tomcat:7 --expose --port=8080 +$ kubectl run tomcat --image=tomcat:9 --expose --port=8080 kubectl run --generator=deployment/apps.v1 is DEPRECATED and will be removed in a future version. Use kubectl run --generator=run-pod/v1 or kubectl create instead. service/tomcat created deployment.apps/tomcat created @@ -13,7 +13,7 @@ deployment.apps/tomcat created # Deployment info $ kubectl get deployments -o wide --selector run=tomcat NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE CONTAINERS IMAGES SELECTOR -tomcat 1 1 1 1 12m tomcat tomcat:7 run=tomcat +tomcat 1 1 1 1 12m tomcat tomcat:9 run=tomcat # Pods info $ kubectl get pods -o wide --selector run=tomcat From 7ee2093bb586106a5fe0d7c1e860cfc67b448861 Mon Sep 17 00:00:00 2001 From: duanyingluo Date: Thu, 13 Feb 2020 23:43:24 +0800 Subject: [PATCH 3/4] Tomcat 9 --- README.md | 2 +- docs/zh-cn/quickstart.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index bed0d7f..aaee43c 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ deployment.apps/tomcat created # Deployment info $ kubectl get deployments -o wide --selector run=tomcat NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE CONTAINERS IMAGES SELECTOR -tomcat 1 1 1 1 12m tomcat tomcat:7 run=tomcat +tomcat 1 1 1 1 12m tomcat tomcat:9 run=tomcat # Pods info $ kubectl get pods -o wide --selector run=tomcat diff --git a/docs/zh-cn/quickstart.md b/docs/zh-cn/quickstart.md index bb807f0..da7a52b 100644 --- a/docs/zh-cn/quickstart.md +++ b/docs/zh-cn/quickstart.md @@ -12,7 +12,7 @@ deployment.apps/tomcat created $ kubectl get deployments -o wide --selector run=tomcat NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE CONTAINERS IMAGES SELECTOR -tomcat 1 1 1 1 12m tomcat tomcat:7 run=tomcat +tomcat 1 1 1 1 12m tomcat tomcat:9 run=tomcat $ kubectl get pods -o wide --selector run=tomcat NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE @@ -110,7 +110,7 @@ SSH Remote port-forward for POD starting 2019/06/19 11:19:14 ssh remote port-forward start at pid: 3567 ``` -在本地或者集群中访问原本指向Tomcat:7的应用,查看输出结果: +在本地或者集群中访问原本指向Tomcat:9的应用,查看输出结果: > 注意如果未运行`ktctl connect`,只能从集群内访问 From c0ab3bb0ba6043a04987e6fa3047d19a6be39e7a Mon Sep 17 00:00:00 2001 From: duanyingluo Date: Fri, 14 Feb 2020 00:05:57 +0800 Subject: [PATCH 4/4] Tomcat 9 --- README.md | 42 ++++++++++++++++++++++++--------------- docs/en-us/quickstart.md | 42 ++++++++++++++++++++++++--------------- docs/zh-cn/quickstart.md | 43 +++++++++++++++++++++++++--------------- 3 files changed, 79 insertions(+), 48 deletions(-) diff --git a/README.md b/README.md index aaee43c..fd6de55 100644 --- a/README.md +++ b/README.md @@ -24,47 +24,57 @@ You can download and install the ktctl from [Downloads And Install](https://rdc- ``` $ kubectl run tomcat --image=tomcat:9 --expose --port=8080 -kubectl run --generator=deployment/apps.v1 is DEPRECATED and will be removed in a future version. Use kubectl run --generator=run-pod/v1 or kubectl create instead. -service/tomcat created -deployment.apps/tomcat created +service "tomcat" created +deployment.apps "tomcat" created # Deployment info $ kubectl get deployments -o wide --selector run=tomcat -NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE CONTAINERS IMAGES SELECTOR -tomcat 1 1 1 1 12m tomcat tomcat:9 run=tomcat +NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE CONTAINERS IMAGES SELECTOR +tomcat 1 1 1 1 47s tomcat tomcat:9 run=tomcat # Pods info $ kubectl get pods -o wide --selector run=tomcat -NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE -tomcat-cc7648444-r9tw4 1/1 Running 0 2m 172.16.0.147 cn-beijing.i-2ze11lz4lijf1pmecnwp +NAME READY STATUS RESTARTS AGE IP NODE +tomcat-5b75798b56-228r4 1/1 Running 0 1m 172.23.2.231 cn-beijing.192.168.0.8 # Service info $ kubectl get svc tomcat -NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE -tomcat ClusterIP 172.19.143.139 8080/TCP 4m +NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE +tomcat ClusterIP 172.21.14.57 8080/TCP 1m ``` ### Connect: Access Kubernetes resource from local ``` $ sudo ktctl connect -2019/06/19 11:11:07 Deploying proxy deployment kt-connect-daemon in namespace default -2019/06/19 11:11:07 Pod status is Pending -2019/06/19 11:11:09 Pod status is Running -2019/06/19 11:11:09 Success deploy proxy deployment kt-connect-daemon in namespace default -2019/06/19 11:11:18 KT proxy start successful +11:48PM INF Connect Start At 27758 +11:48PM INF Client address 192.168.3.120 +11:48PM INF Deploying shadow deployment kt-connect-daemon-uhojp in namespace default + +11:48PM INF Shadow Pod status is Pending +11:48PM INF Shadow Pod status is Running +11:48PM INF Shadow is ready. +11:48PM INF Success deploy proxy deployment kt-connect-daemon-uhojp in namespace default + +Forwarding from 127.0.0.1:2222 -> 22 +Forwarding from [::1]:2222 -> 22 +Handling connection for 2222 +Warning: Permanently added '[127.0.0.1]:2222' (ECDSA) to the list of known hosts. +client: Connected. ``` Access PodIP: ``` -curl http://172.16.0.147:8080 +curl http://172.23.2.231:8080 +HTTP Status 404 – Not Found

HTTP Status 404 – Not Found


Type Status Report

Message Not found

Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.


Apache Tomcat/9.0.31

``` Access ClusterIP: ``` -$ curl http://172.19.143.139:8080 +$ curl http://172.21.14.57:8080 +HTTP Status 404 – Not Found

HTTP Status 404 – Not Found


Type Status Report

Message Not found

Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.


Apache Tomcat/9.0.31

``` Access Server internal DNS address diff --git a/docs/en-us/quickstart.md b/docs/en-us/quickstart.md index 2d9a31e..4546328 100644 --- a/docs/en-us/quickstart.md +++ b/docs/en-us/quickstart.md @@ -6,24 +6,23 @@ In this chapter, we will deployment a sample app(tomcat:9) in Kubernetes cluster ``` shell $ kubectl run tomcat --image=tomcat:9 --expose --port=8080 -kubectl run --generator=deployment/apps.v1 is DEPRECATED and will be removed in a future version. Use kubectl run --generator=run-pod/v1 or kubectl create instead. -service/tomcat created -deployment.apps/tomcat created +service "tomcat" created +deployment.apps "tomcat" created # Deployment info $ kubectl get deployments -o wide --selector run=tomcat -NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE CONTAINERS IMAGES SELECTOR -tomcat 1 1 1 1 12m tomcat tomcat:9 run=tomcat +NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE CONTAINERS IMAGES SELECTOR +tomcat 1 1 1 1 47s tomcat tomcat:9 run=tomcat # Pods info $ kubectl get pods -o wide --selector run=tomcat -NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE -tomcat-cc7648444-r9tw4 1/1 Running 0 2m 172.16.0.147 cn-beijing.i-2ze11lz4lijf1pmecnwp +NAME READY STATUS RESTARTS AGE IP NODE +tomcat-5b75798b56-228r4 1/1 Running 0 1m 172.23.2.231 cn-beijing.192.168.0.8 # Service info $ kubectl get svc tomcat -NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE -tomcat ClusterIP 172.19.143.139 8080/TCP 4m +NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE +tomcat ClusterIP 172.21.14.57 8080/TCP 1m ``` ## Connect: Access APP From Local @@ -40,16 +39,27 @@ Connect to kubernetes cluster, KT will deployment a proxy pod in cluster: ```shell $ sudo ktctl connect --method=vpn -2019/06/19 11:11:07 Deploying proxy deployment kt-connect-daemon in namespace default -2019/06/19 11:11:07 Pod status is Pending -2019/06/19 11:11:09 Pod status is Running -2019/06/19 11:11:09 Success deploy proxy deployment kt-connect-daemon in namespace default -2019/06/19 11:11:18 KT proxy start successful +11:48PM INF Connect Start At 27758 +11:48PM INF Client address 192.168.3.120 +11:48PM INF Deploying shadow deployment kt-connect-daemon-uhojp in namespace default + +11:48PM INF Shadow Pod status is Pending +11:48PM INF Shadow Pod status is Running +11:48PM INF Shadow is ready. +11:48PM INF Success deploy proxy deployment kt-connect-daemon-uhojp in namespace default + +Forwarding from 127.0.0.1:2222 -> 22 +Forwarding from [::1]:2222 -> 22 +Handling connection for 2222 +Warning: Permanently added '[127.0.0.1]:2222' (ECDSA) to the list of known hosts. +client: Connected. ``` ``` -$ curl http://172.16.0.147:8080 #Access PodIP from local -$ curl http://172.19.143.139:8080 #Access ClusterIP +$ curl http://172.23.2.231:8080 #Access PodIP from local +HTTP Status 404 – Not Found

HTTP Status 404 – Not Found


Type Status Report

Message Not found

Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.


Apache Tomcat/9.0.31

+$ curl http://172.21.14.57:8080 #Access ClusterIP +HTTP Status 404 – Not Found

HTTP Status 404 – Not Found


Type Status Report

Message Not found

Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.


Apache Tomcat/9.0.31

$ curl http://tomcat:8080 #Access Server internal DNS address ``` diff --git a/docs/zh-cn/quickstart.md b/docs/zh-cn/quickstart.md index da7a52b..509b25f 100644 --- a/docs/zh-cn/quickstart.md +++ b/docs/zh-cn/quickstart.md @@ -6,21 +6,20 @@ ``` shell $ kubectl run tomcat --image=tomcat:9 --expose --port=8080 -kubectl run --generator=deployment/apps.v1 is DEPRECATED and will be removed in a future version. Use kubectl run --generator=run-pod/v1 or kubectl create instead. -service/tomcat created -deployment.apps/tomcat created +service "tomcat" created +deployment.apps "tomcat" created $ kubectl get deployments -o wide --selector run=tomcat -NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE CONTAINERS IMAGES SELECTOR -tomcat 1 1 1 1 12m tomcat tomcat:9 run=tomcat +NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE CONTAINERS IMAGES SELECTOR +tomcat 1 1 1 1 47s tomcat tomcat:9 run=tomcat $ kubectl get pods -o wide --selector run=tomcat -NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE -tomcat-cc7648444-r9tw4 1/1 Running 0 2m 172.16.0.147 cn-beijing.i-2ze11lz4lijf1pmecnwp +NAME READY STATUS RESTARTS AGE IP NODE +tomcat-5b75798b56-228r4 1/1 Running 0 1m 172.23.2.231 cn-beijing.192.168.0.8 $ kubectl get svc tomcat -NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE -tomcat ClusterIP 172.19.143.139 8080/TCP 4m +NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE +tomcat ClusterIP 172.21.14.57 8080/TCP 1m ``` ## Connect:连接集群网络 @@ -37,18 +36,30 @@ tomcat ClusterIP 172.19.143.139 8080/TCP 4m ```shell $ sudo ktctl connect --method=vpn -2019/06/19 11:11:07 Deploying proxy deployment kt-connect-daemon in namespace default -2019/06/19 11:11:07 Pod status is Pending -2019/06/19 11:11:09 Pod status is Running -2019/06/19 11:11:09 Success deploy proxy deployment kt-connect-daemon in namespace default -2019/06/19 11:11:18 KT proxy start successful +11:48PM INF Connect Start At 27758 +11:48PM INF Client address 192.168.3.120 +11:48PM INF Deploying shadow deployment kt-connect-daemon-uhojp in namespace default + +11:48PM INF Shadow Pod status is Pending +11:48PM INF Shadow Pod status is Running +11:48PM INF Shadow is ready. +11:48PM INF Success deploy proxy deployment kt-connect-daemon-uhojp in namespace default + +Forwarding from 127.0.0.1:2222 -> 22 +Forwarding from [::1]:2222 -> 22 +Handling connection for 2222 +Warning: Permanently added '[127.0.0.1]:2222' (ECDSA) to the list of known hosts. +client: Connected. ``` 启用VPN后直接访问集群资源: ``` -$ curl http://172.16.0.147:8080 #在本地直接访问PodIP -$ curl http://172.19.143.139:8080 #在本地访问ClusteriIP +$ curl curl http://172.23.2.231:8080 #在本地直接访问PodIP +HTTP Status 404 – Not Found

HTTP Status 404 – Not Found


Type Status Report

Message Not found

Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.


Apache Tomcat/9.0.31

+ +$ curl http://172.21.14.57:8080 #在本地访问ClusteriIP +HTTP Status 404 – Not Found

HTTP Status 404 – Not Found


Type Status Report

Message Not found

Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.


Apache Tomcat/9.0.31

$ curl http://tomcat:8080 #使用Service的域名访问 ```