From 823a5e6ff231389e2670d8ca7444d67cb31a54e8 Mon Sep 17 00:00:00 2001 From: Li Yi Date: Sun, 17 Nov 2019 20:04:28 +0800 Subject: [PATCH] Update to Istio v1.4.0 --- README.md | 67 +++++++++++++++++++--------------------- README_en.md | 86 ++++++++++++++++++++++++++++++++++++++-------------- 2 files changed, 96 insertions(+), 57 deletions(-) diff --git a/README.md b/README.md index 790c980..dfce322 100644 --- a/README.md +++ b/README.md @@ -286,13 +286,13 @@ helm repo update 说明:Istio Ingress Gateway和Ingress缺省的端口冲突,请移除Ingress并进行下面测试 -可以根据文档安装 Istio https://istio.io/docs/setup/kubernetes/ +可以根据文档安装 Istio https://istio.io/docs/setup/getting-started/ -#### 下载 Istio 1.3.3 并安装 CLI +#### 下载 Istio 1.4.0 ```bash -curl -L https://git.io/getLatestIstio | ISTIO_VERSION=1.3.3 sh - -cd istio-1.3.3/ +curl -L https://istio.io/downloadIstio | ISTIO_VERSION=1.4.0 sh - +cd istio-1.4.0 export PATH=$PWD/bin:$PATH ``` @@ -304,23 +304,16 @@ export PATH=$PWD/bin:$PATH -#### 通过 Helm chart 安装 Istio +#### 安装 Istio ```shell -# 安装 istio-init chart 安装所有的 Istio CRD - helm install install/kubernetes/helm/istio-init --name istio-init --namespace istio-system - -# 验证下安装的 Istio CRD 个数, 应该安装23个CRD -kubectl get crds | grep 'istio.io\|certmanager.k8s.io' | wc -l - -# 开始 istio chart 安装 -helm install install/kubernetes/helm/istio --name istio --namespace istio-system +istioctl manifest apply --set profile=demo ``` -#### 查看 istio 发布状态 +#### 检查 Istio 状态 ```shell -helm status istio +kubectl get pods -n istio-system ``` #### 为 ```default``` 名空间开启自动 sidecar 注入 @@ -332,42 +325,47 @@ kubectl get namespace -L istio-injection #### 安装 Book Info 示例 +请参考 https://istio.io/docs/examples/bookinfo/ + ```shell kubectl apply -f samples/bookinfo/platform/kube/bookinfo.yaml -kubectl apply -f samples/bookinfo/networking/bookinfo-gateway.yaml ``` +查看示例应用资源 + +```shell +kubectl get svc,pod +``` 确认示例应用在运行中 -```bash -export GATEWAY_URL=localhost:80 -curl -o /dev/null -s -w "%{http_code}\n" http://${GATEWAY_URL}/productpage +```shell +kubectl exec -it $(kubectl get pod -l app=ratings -o jsonpath='{.items[0].metadata.name}') -c ratings -- curl productpage:9080/productpage | grep -o ".*" ``` -可以通过浏览器访问 - -http://localhost/productpage +创建 Ingress Gateway +```shell +kubectl apply -f samples/bookinfo/networking/bookinfo-gateway.yaml +``` -说明:如果当前80端口已经被占用或保留,我们可以编辑 ```install/kubernetes/helm/istio/values.yaml``` 文件中 -Gateway 端口进行调整,比如将 80 端口替换为 8888 端口 +查看 Gateway 配置 -``` - ## You can add custom gateway ports - - port: 8888 # Changed from 80 - targetPort: 80 - name: http2 - nodePort: 31380 +```shell +kubectl get gateway ``` -然后执行如下命令并生效 +确认示例应用可以访问 ```shell -kubectl delete service istio-ingressgateway -n istio-system -helm upgrade istio install/kubernetes/helm/istio +export GATEWAY_URL=localhost:80 +curl -s http://${GATEWAY_URL}/productpage | grep -o ".*" ``` +可以通过浏览器访问 + +http://localhost/productpage + #### 删除实例应用 ```bash @@ -377,8 +375,7 @@ samples/bookinfo/platform/kube/cleanup.sh ### 卸载 Istio ```shell -helm del --purge istio -kubectl delete -f install/kubernetes/helm/istio/templates/crds.yaml -n istio-system +istioctl manifest generate --set profile=demo | kubectl delete -f - ``` diff --git a/README_en.md b/README_en.md index ec595c5..31afdf6 100644 --- a/README_en.md +++ b/README_en.md @@ -176,63 +176,105 @@ helm init --upgrade -i registry.cn-hangzhou.aliyuncs.com/google_containers/tille helm repo update ``` -### Install Istio +### Setup Istio -More details can be found in https://istio.io/docs/setup/kubernetes/ +More details can be found in https://istio.io/docs/setup/getting-started/ -Download Istio 1.3.3 and install CLI +#### Download Istio 1.4.0 and install CLI -```bash -curl -L https://git.io/getLatestIstio | ISTIO_VERSION=1.3.3 sh - -cd istio-1.3.3/ +```shell +curl -L https://git.io/getLatestIstio | ISTIO_VERSION=1.4.0 sh - +cd istio-1.4.0/ export PATH=$PWD/bin:$PATH ``` -Install Istio with Helm chart +In Windows, you can download the Istio manually, or copy ```getLatestIstio.ps1``` to your Istio directory, and execute the script. -```shell -# Install the istio-init chart to bootstrap all the Istio’s CRDs -helm install install/kubernetes/helm/istio-init --name istio-init --namespace istio-system +NOTE: It refer the [scripts](https://gist.github.com/kameshsampath/796060a806da15b39aa9569c8f8e6bcf) from community. + +```powershell +.\getLatestIstio.ps1 +``` -# Verify that all Istio CRDs were committed to the Kubernetes api-server -kubectl get crds | grep 'istio.io\|certmanager.k8s.io' | wc -l +#### Install Istio -# Install the istio chart -helm install install/kubernetes/helm/istio --name istio --namespace istio-system +```shell +istioctl manifest apply --set profile=demo ``` Check status of istio release ```shell -helm status istio +kubectl get pods -n istio-system ``` -Enable automatic sidecar injection for ```default``` namespace +#### Enable automatic sidecar injection for ```default``` namespace ```shell kubectl label namespace default istio-injection=enabled kubectl get namespace -L istio-injection ``` -Install Book Info sample +#### Install Book Info sample + +Please refer https://istio.io/docs/examples/bookinfo/ ```shell kubectl apply -f samples/bookinfo/platform/kube/bookinfo.yaml +``` + +Check the resources of sample application + +```shell +kubectl get svc,pod +``` + +Confirm the application is running + +```shell +kubectl exec -it $(kubectl get pod -l app=ratings -o jsonpath='{.items[0].metadata.name}') -c ratings -- curl productpage:9080/productpage | grep -o ".*" +``` + +Create Ingress Gateway + +```shell kubectl apply -f samples/bookinfo/networking/bookinfo-gateway.yaml +``` + +Check Gateway status + +```shell +kubectl get gateway +``` + +Confirm the application is accessible + +```shell +export GATEWAY_URL=localhost:80 +curl -s http://${GATEWAY_URL}/productpage | grep -o ".*" +``` + +Open with browser http://localhost/productpage -Confirm application is running +#### Confirm application is running -​```bash +```shell export GATEWAY_URL=localhost:80 curl -o /dev/null -s -w "%{http_code}\n" http://${GATEWAY_URL}/productpage ``` -Delete Istio +#### Cleanup sample application ```shell -helm del --purge istio -kubectl delete -f install/kubernetes/helm/istio/templates/crds.yaml -n istio-system +samples/bookinfo/platform/kube/cleanup.sh ``` +#### Delete Istio + +```shell +istioctl manifest generate --set profile=demo | kubectl delete -f - +``` + +