Installation and operation of exemplary istio bookinfo

 

purpose

This article is designed to help understand istio want to install and run bookinfo example students QuickStart

 

Pre-preparation

Installation k8s and helm

1, k8s installation

Modify the hostname
hostnamectl set-hostname k8s-master
hostnamectl set-hostname k8s-node
Ali Cloud environment configure yum source gpg and check the configuration
docker-ce 
under /etc/yum.repos.d directory 
wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo 

Kubernetes 
under /etc/yum.repos.d directory 

vim kubenetes .repo 

[Kubernetes] 
name = Kubernetes Repo 
BaseURL = HTTPS: //mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/ 
gpgcheck. 1 = 
gpgkey = HTTPS: //mirrors.aliyun.com/kubernetes/ yum / DOC / yum-key.gpg 
Enabled. 1 = 

gpg check the configuration

wget https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
wget https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg
rpm --import rpm-package-key.gpg
rpm --import yum-key.gpg
According to the official installation kubeadm example (installing version 1.15.4 k8s)

 

yum -y install Rocker-ce-omelet-kubeadm 1.15.4 1.15.4 1.15.4-kubectl 

 

Set an example of environmental parameters in accordance with official

https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/

https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/

 

kubeadm init run with Ali cloud images

The init kubeadm \ 
image-repository registryaliyuncscomgooglecontainers \ 
pod-network-cidr = 1024400/16 And

Wherein 10.244.0.0/16 is flannel network parameters will be added

 

2, helm installation

1. Download and install
wget https://get.helm.sh/helm-v2.14.3-linux-amd64.tar.gz
tar -zxf helm-v2.14.3-linux-amd64.tar.gz
cd linux-amd64
chmod +x helm
mv helm /usr/local/bin
2. Make sure you have a cluster administrator defines the role of the service account for the Tiller
kubectl apply -f https://raw.githubusercontent.com/istio/istio/release-1.3/install/kubernetes/helm/helm-service-account.yaml
3. Ali mirror installation tiller, while the repo changed to Microsoft's helm repo
helm init --upgrade -i registry.cn-hangzhou.aliyuncs.com/google_containers/tiller:v2.14.3 --stable-repo-url http://mirror.azure.cn/kubernetes/charts/ --service-account=tiller

Istio installation

1. Download the installation package

Reference Address: https://istio.io/docs/setup/#downloading-the-release

curl -L https://git.io/getLatestIstio | ISTIO_VERSION=1.3.1 sh -
cd istio-1.3.1
export PATH=$PWD/bin:$PATH

2. Installation istio with helm install and Helm Tiller

Reference Address:  https://istio.io/docs/setup/install/helm/

Use kubectl apply to install all Istio custom resource definition (CRD), and wait a few seconds for submission to the CRD in Kubernetes API server:

helm install install/kubernetes/helm/istio-init --name istio-init --namespace istio-system --set gateways.istio-ingressgateway.type=NodePort

Use the following command to verify that all 23 Istio CRD are submitted to Kubernetes api server:

kubectl get crds | grep 'istio.io' | wc -l

Select a profile, and then install the files you selected corresponds istio chart:

helm install install/kubernetes/helm/istio --name istio --namespace istio-system \
--values install/kubernetes/helm/istio/values-istio-demo.yaml \
--set gateways.istio-ingressgateway.type=NodePort

3. Run bookinfo example

Reference Address:  https://istio.io/docs/examples/bookinfo/

kubectl label namespace default istio-injection=enabled
kubectl apply -f samples/bookinfo/platform/kube/bookinfo.yaml
kubectl get pods
kubectl apply -f samples/bookinfo/networking/bookinfo-gateway.yaml
export INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http2")].nodePort}')
export SECURE_INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="https")].nodePort}')
export INGRESS_HOST=<k8s-node ip>
export GATEWAY_URL=$INGRESS_HOST:$INGRESS_PORT

Browser to access HTTP: // $ {} GATEWAY_URL / productpage

More Reference Example: https://istio.io/docs/tasks/

Guess you like

Origin www.cnblogs.com/caozhiyuan/p/11621732.html