November 13-15, KubeCon Shanghai conference was held, cloud native is the hottest technology this fall. Many students asked how to get started with Kubernetes and Istio service grid development. This article will help you build a Kubernetes + Istio development environment from scratch on your laptop in 15 minutes with Docker CE Desktop.

This article tested the environment Docker CE 18.09 (Kubernetes 1.10.3) and Istio 1.0.4

You need a Docker for Mac or Docker for Windows installation package, if not please download the latest version of Docker CE. Due to the large number of Kubernetes container images in GCR. IO, there is no guarantee of stable access in the country. We provide some tool scripts to help download the required image from Ali Cloud image service

First of all,

git clone https://github.com/AliyunContainerService/k8s-for-docker-desktop
cd k8s-for-docker-desktopCopy the code

Docker for Mac enabled Kubernetes

Chinese official image acceleration for Docker Daemon https://registry.docker-cn.com

Optional: Configure CPU and memory resources for Kubernetes. 4GB or more memory is recommended.

Download Kubernetes images from Aliyun Docker image service in advance. You can load your own images by modifying the images.properties file

./load_images.shCopy the code

Start Kubernetes and wait for Kubernetes to start running

Kubernetes Docker for Windows

Chinese official image acceleration for Docker Daemon https://registry.docker-cn.com

Optional: Configure CPU and memory resources for Kubernetes. 4GB or more memory is recommended.

Download Kubernetes images from Aliyun Docker image service in advance. You can load your own images by modifying the images.properties file

Using the Bash shell

./load_images.shCopy the code

Using PowerShell

 .\load_images.ps1Copy the code

Note: If you cannot execute PowerShell scripts because of security policies, run the set-executionPolicy remotesunet command in the PowerShell “Run as an administrator”.

Start Kubernetes and wait for Kubernetes to start running

Configuration Kubernetes

Optional: Switch Kubernetes running context to Docker-for-desktop

kubectl config use-context docker-for-desktopCopy the code

Verify Kubernetes cluster status

kubectl cluster-info
kubectl get nodesCopy the code

The deployment of Kubernetes dashboard

kubectl create -f https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yamlCopy the code

or

kubectl create -f kubernetes-dashboard.yamlCopy the code

Enable the API Server access proxy

kubectl proxyCopy the code

Access the Kubernetes Dashboard at the following URL

http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/#! /overview? namespace=default

Note: To test Istio, you do not need to install the Ingress. If you need the Ingress, please refer to github.com/AliyunConta… Ingress section in

Install the Helm

You can install helm github.com/helm/helm/b according to the documentation…

Install on Mac OS

# Use homebrew on Mac
brew install kubernetes-helm

# Install Tiller into your Kubernetes clusterHelm init - upgrade - I registry.cn-hangzhou.aliyuncs.com/google_containers/tiller:v2.11.0 - skip - refresh# update charts repo (Optional)
helm repo updateCopy the code

Install on Windows

# Use Chocolatey on Windows
choco install kubernetes-helm

# Install Tiller into your Kubernetes clusterHelm init - upgrade - I registry.cn-hangzhou.aliyuncs.com/google_containers/tiller:v2.11.0 - skip - refresh# update charts repo (Optional)
helm repo updateCopy the code

Configuration Istio

Istio Istio. IO /docs/setup/…

Download Istio 1.0.4 and install the CLI

curl -L https://git.io/getLatestIstio | sh -
cdIstio - / 1.0.4export PATH=$PWD/bin:$PATHCopy the code

On Windows, you can manually download the Istio installation package, or copy getlatestistio.ps1 to the directory where you want to download Istio and execute – Description: Modified from the installation script provided by the community

.\getLatestIstio.ps1Copy the code

Install Istio through Helm Chart

helm install install/kubernetes/helm/istio --name istio --namespace istio-systemCopy the code

View isTIO publication status

helm status istioCopy the code

Enable automatic Sidecar injection for the default namespace

kubectl label namespace default istio-injection=enabled
kubectl get namespace -L istio-injectionCopy the code

Install the Book Info sample

kubectl apply -f samples/bookinfo/platform/kube/bookinfo.yaml
kubectl apply -f samples/bookinfo/networking/bookinfo-gateway.yamlCopy the code

Verify that the sample application is running

export GATEWAY_URL=localhost:80
curl -o /dev/null -s -w "%{http_code}\n" http://${GATEWAY_URL}/productpageCopy the code

It can be accessed through a browser

http://localhost/productpage

Note: if the current port 80 has been occupied or reserved, we can edit the install/kubernetes/helm/istio/values. The yaml file to adjust the Gateway port, such as the port 80 replaced with port 8888

      ## You can add custom gateway ports
    - port: 8888  # Changed from 80
      targetPort: 80
      name: http2
      nodePort: 31380Copy the code

Then run the following command to take effect

kubectl delete service istio-ingressgateway -n istio-system
helm upgrade istio install/kubernetes/helm/istioCopy the code

Learning Istio

IO/en /docs/exa…

Deleting an Instance Application

samples/bookinfo/platform/kube/cleanup.shCopy the code

Uninstall Istio

helm del --purge istio
kubectl delete -f install/kubernetes/helm/istio/templates/crds.yaml -n istio-systemCopy the code

conclusion

Alibaba Cloud Kubernetes service (ACK) has provided support for Istio, and has deeply integrated Istio and Alibaba Cloud. For example, Alibaba Cloud log service can support full-link monitoring based on Jaeger, and improve Istio observability and alarm ability based on cloud monitoring. We will further simplify the Kubernetes and Istio developer experience, making it easy to seamlessly migrate Kubernetes + Istio applications to the cloud.

Develop reading

  • Kubernetes Chinese documentation
  • Istio Chinese document
  • Istio official documentation – Aliyun Kubernetes service (ACK) support
  • Istio practice on Aliyun Kubernetes service
  • Ali Cloud container service team blog Istio practice series of articles – constantly updated
  • ServiceMesher community

The original link