Istio Environment
1. Preparing & Setup
Before you want to setup local development environment, you must setup local k8s cluster first. Please refer following link to prepare it:
- Install a hypervisor
- Install kubectl
- Install Minikube
1.1. Install VM ( Recommend xhyve on Mac )
Because the demo environment is MacOS, you can do as following:
brew install docker-machine-driver-xhyve
# docker-machine-driver-xhyve need root owner and uid, following steps are required.
$ sudo chown root:wheel $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
$ sudo chmod u+s $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
1.2. Minikube Install
MacOS
For other system please refer above installing guide.
1.3. Kubernete Client
MacOS
1.4. Start Environment
- Start minikube
>> minikube start
Starting local Kubernetes v1.8.0 cluster...
Starting VM...
Getting VM IP address...
Moving files into cluster...
Setting up certs...
Connecting to cluster...
Setting up kubeconfig...
Starting cluster components...
Kubectl is now configured to use the cluster.
Loading cached images from config up.god.file.
>> kubectl version
Client Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.4", \
GitCommit:"9befc2b8928a9426501d3bf62f72849d5cbcd5a3", GitTreeState:"clean", \
BuildDate:"2017-11-20T19:11:02Z", GoVersion:"go1.9.2", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.0", \
GitCommit:"0b9efaeb34a2fc51ff8e4d34ad9bc6375459c4a4", GitTreeState:"clean", \
BuildDate:"2017-11-29T22:43:34Z", GoVersion:"go1.9.1", Compiler:"gc", Platform:"linux/amd64"}
>> kubectl run hello-minikube --image=gcr.io/google_containers/echoserver:1.8 --port=6001
deployment "hello-minikube" created
Then your basic environment has been finished.
2. Istio Envrionment
Demo example will be install istio to ~/Tool/Zero/
- Install and download istio
curl -L https://git.io/getLatestIstio | sh -
...... # Wait for ISO up.god.file downloading finished.
- Set Up environment.
Add /Users/lang/Tool/Zero/istio-0.2.12/bin to your path; \
e.g copy paste in your shell and/or ~/.profile:
export PATH="$PATH:/Users/lang/Tool/Zero/istio-0.2.12/bin"
# Then be sure the command "istioctl" could be used. ( Latest 0.2.12 )
istioctl version
Version: 0.2.12
GitRevision: 998e0e00d375688bcb2af042fc81a60ce5264009
GitBranch: release-0.2
User: releng@0d29a2c0d15f
GolangVersion: go1.8
>> cd istio-0.2.12
>> pwd
/Users/lang/Tool/Zero/istio-0.2.12
>> kubectl get svc -n istio-system
No resources found.
>> kubectl apply -f install/kubernetes/istio.yaml ( None TLS mode )
namespace "istio-system" created
...... ( All the progress logs will be output )
deployment "istio-ca" created
- Ensure the four services:
istio-pilot, istio-mixer, istio-ingress, istio-egress
>> kubectl get svc -n istio-system
NAME TYPE CLUSTER-IP ......
istio-egress ClusterIP 10.97.67.39 ......
istio-ingress LoadBalancer 10.111.235.49 ......
istio-mixer ClusterIP 10.106.88.96 ......
istio-pilot ClusterIP 10.106.188.200 ......
>> kubectl get pods -n istio-system
istio-ca-5cd46b967c-kmx58 1/1 Running 0 4m
istio-egress-56c4d999bc-dv8md 1/1 Running 0 4m
istio-ingress-5747bb855f-n74sz 1/1 Running 0 4m
istio-mixer-77487797f6-d5ns9 2/2 Running 0 4m
istio-pilot-86ddcb7ff5-cmcr5 1/1 Running 0 4m
- Select "istio-system" on the dashboard left menu
3. Addon for Istio
If you want to enable metrics collection, you can do as following:
kubectl apply -f install/kubernetes/addons/prometheus.yaml
kubectl apply -f install/kubernetes/addons/grafana.yaml
kubectl apply -f install/kubernetes/addons/servicegraph.yaml
It may take some time to process all the components installed.
3.1. Install Grafana
- You can type following command to configure port-forwarding for
grafana
kubectl -n istio-system port-forward \
$(kubectl -n istio-system get pod -l app=grafana -o jsonpath='{.items[0].metadata.name}') \
3000:3000 &
http://localhost:3000/dashboard/db/istio-dashboard
with your browser.
3. You should see following page:
3.2. Service Graph
- You can type following command to configure port-forwarding for
servicegraph
kubectl -n istio-system port-forward \
$(kubectl get pod -n istio-system -l app=servicegraph -o jsonpath='{.items[0].metadata.name}') \
8088:8088 &
http://localhost:8088/dotviz
or http://localhost:8088/graph
with your browser, if there exist the
services, you should see JSON data or graph.
3.3. Zipkin Dashboard
- You can type following command to configure port-forwarding for
zipkin
kubectl -n istio-system port-forward \
$(kubectl get pod -n istio-system -l app=zipkin -o jsonpath='{.items[0].metadata.name}') \
9411:9411 &
http://localhost:9411/zipkin/
with your browser:
3. You should see following page:
3.4. Prometheus
- You can type following command to configure port-forwarding for
prometheus
kubectl -n istio-system port-forward \
$(kubectl -n istio-system get pod -l app=prometheus -o jsonpath='{.items[0].metadata.name}') \
9090:9090 &
http://localhost:9090/graph
with your browser:
3. You should see following page:
Summary
Then the docker and istio environments have been both prepared.