YJWANG

[kubernetes] istio 구축 v1.8 본문

60.Cloud/80.Kubernetes

[kubernetes] istio 구축 v1.8

왕영주 2021. 1. 15. 16:13

istio 공식 홈페이지에 기술된 'Getting Started' 기준으로 정리된 포스팅이다.

Environment


[root@master01 ~]# kubectl version
Client Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.7", GitCommit:"1dd5338295409edcfff11505e7bb246f0d325d15", GitTreeState:"clean", BuildDate:"2021-01-13T13:23:52Z", GoVersion:"go1.15.5", Compiler:"gc", Platform:"linux/amd64"}

Server Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.7", GitCommit:"1dd5338295409edcfff11505e7bb246f0d325d15", GitTreeState:"clean", BuildDate:"2021-01-13T13:15:20Z", GoVersion:"go1.15.5", Compiler:"gc", Platform:"linux/amd64"}

refer to


구축 진행


Download istio

[root@master01 ~]# curl -L https://istio.io/downloadIstio | sh -
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100   102  100   102    0     0    204      0 --:--:-- --:--:-- --:--:--   204
100  4579  100  4579    0     0   4789      0 --:--:-- --:--:-- --:--:--  4789

Downloading istio-1.8.2 from https://github.com/istio/istio/releases/download/1.8.2/istio-1.8.2-linux-amd64.tar.gz ...

Istio 1.8.2 Download Complete!

Istio has been successfully downloaded into the istio-1.8.2 folder on your system.

Next Steps:
See https://istio.io/latest/docs/setup/install/ to add Istio to your Kubernetes cluster.

To configure the istioctl client tool for your workstation,
add the /root/istio-1.8.2/bin directory to your environment path variable with:
     export PATH="$PATH:/root/istio-1.8.2/bin"

Begin the Istio pre-installation check by running:
     istioctl x precheck 

Need more information? Visit https://istio.io/latest/docs/setup/install/ 

Set env

[root@master01 ~]# cd istio-1.8.2
[root@master01 istio-1.8.2]# ls -l
합계 28
-rw-r--r--.  1 root root 11348  1월 13 01:06 LICENSE
-rw-r--r--.  1 root root  5866  1월 13 01:06 README.md
drwxr-x---.  2 root root    22  1월 13 01:06 bin
-rw-r-----.  1 root root   853  1월 13 01:06 manifest.yaml
drwxr-xr-x.  5 root root    52  1월 13 01:06 manifests
drwxr-xr-x. 19 root root  4096  1월 13 01:06 samples
drwxr-x---.  3 root root    83  1월 13 01:06 tools

[root@master01 istio-1.8.2]# export PATH=$PWD/bin:$PATH

install istio

[root@master01 istio-1.8.2]# istioctl install --set profile=demo -y
Detected that your cluster does not support third party JWT authentication. Falling back to less secure first party JWT. See https://istio.io/v1.8/docs/ops/best-practices/security/#configure-third-party-service-account-tokens for details.
✔ Istio core installed                                                                                                               
✔ Istiod installed                                                                                                                   
✔ Egress gateways installed                                                                                                          
✔ Ingress gateways installed                                                                                                         
✔ Installation complete          

set label

[root@master01 istio-1.8.2]# kubectl label namespace default istio-injection=enabled
namespace/default labeled

테스트를 위한 Application 배포

[root@master01 istio-1.8.2]# kubectl apply -f samples/bookinfo/platform/kube/bookinfo.yaml
service/details created
serviceaccount/bookinfo-details created
deployment.apps/details-v1 created
service/ratings created
serviceaccount/bookinfo-ratings created
deployment.apps/ratings-v1 created
service/reviews created
serviceaccount/bookinfo-reviews created
deployment.apps/reviews-v1 created
deployment.apps/reviews-v2 created
deployment.apps/reviews-v3 created
service/productpage created
serviceaccount/bookinfo-productpage created
deployment.apps/productpage-v1 created

[root@master01 istio-1.8.2]# kubectl get services
NAME          TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)    AGE
details       ClusterIP   10.233.0.254    <none>        9080/TCP   5s
kubernetes    ClusterIP   10.233.0.1      <none>        443/TCP    27m
productpage   ClusterIP   10.233.60.230   <none>        9080/TCP   4s
ratings       ClusterIP   10.233.43.221   <none>        9080/TCP   5s
reviews       ClusterIP   10.233.38.3     <none>        9080/TCP   5s

[root@master01 istio-1.8.2]# kubectl get pods
NAME                              READY   STATUS    RESTARTS   AGE
details-v1-79c697d759-hjp44       2/2     Running   0          39m
productpage-v1-65576bb7bf-cv22r   2/2     Running   0          39m
ratings-v1-7d99676f7f-94zpc       2/2     Running   0          39m
reviews-v1-987d495c-ksjxv         2/2     Running   0          39m
reviews-v2-6c5bf657cf-pd4sh       2/2     Running   0          39m
reviews-v3-5f7b9f4f77-cvnzs       2/2     Running   0          39m

설정 이상 없는지 확인

[root@master01 istio-1.8.2]# istioctl analyze
✔ No validation issues found when analyzing namespace: default.

외부 접근을 위한 gateway 설정
bare-metal에다 설치한 것으로 LoadBalancer가 없다. NodePort로 진행

[root@master01 istio-1.8.2]# kubectl apply -f samples/bookinfo/networking/bookinfo-gateway.yaml
gateway.networking.istio.io/bookinfo-gateway created
virtualservice.networking.istio.io/bookinfo created

[root@master01 istio-1.8.2]# export INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http2")].nodePort}')
[root@master01 istio-1.8.2]# export SECURE_INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="https")].nodePort}')
[root@master01 istio-1.8.2]# export INGRESS_HOST=<WorkerNode IP>
[root@master01 istio-1.8.2]# export GATEWAY_URL=$INGRESS_HOST:$INGRESS_PORT
[root@master01 istio-1.8.2]# echo "$GATEWAY_URL"
<WorkerNode IP>:30826

테스트 시스템 URL 확인

[root@master01 istio-1.8.2]# echo "http://$GATEWAY_URL/productpage"
http://<WorkerNode IP>:30826/productpage

Addon 설치

[root@master01 istio-1.8.2]# kubectl apply -f samples/addons
serviceaccount/grafana created
configmap/grafana created
service/grafana created
deployment.apps/grafana created
configmap/istio-grafana-dashboards created
configmap/istio-services-grafana-dashboards created
deployment.apps/jaeger created
service/tracing created
service/zipkin created
service/jaeger-collector created
Warning: apiextensions.k8s.io/v1beta1 CustomResourceDefinition is deprecated in v1.16+, unavailable in v1.22+; use apiextensions.k8s.io/v1 CustomResourceDefinition
customresourcedefinition.apiextensions.k8s.io/monitoringdashboards.monitoring.kiali.io created
serviceaccount/kiali created
configmap/kiali created
clusterrole.rbac.authorization.k8s.io/kiali-viewer created
clusterrole.rbac.authorization.k8s.io/kiali created
clusterrolebinding.rbac.authorization.k8s.io/kiali created
service/kiali created
deployment.apps/kiali created
serviceaccount/prometheus created
configmap/prometheus created
clusterrole.rbac.authorization.k8s.io/prometheus created
clusterrolebinding.rbac.authorization.k8s.io/prometheus created
service/prometheus created
deployment.apps/prometheus created
unable to recognize "samples/addons/kiali.yaml": no matches for kind "MonitoringDashboard" in version "monitoring.kiali.io/v1alpha1"
unable to recognize "samples/addons/kiali.yaml": no matches for kind "MonitoringDashboard" in version "monitoring.kiali.io/v1alpha1"
unable to recognize "samples/addons/kiali.yaml": no matches for kind "MonitoringDashboard" in version "monitoring.kiali.io/v1alpha1"
unable to recognize "samples/addons/kiali.yaml": no matches for kind "MonitoringDashboard" in version "monitoring.kiali.io/v1alpha1"
unable to recognize "samples/addons/kiali.yaml": no matches for kind "MonitoringDashboard" in version "monitoring.kiali.io/v1alpha1"
unable to recognize "samples/addons/kiali.yaml": no matches for kind "MonitoringDashboard" in version "monitoring.kiali.io/v1alpha1"
unable to recognize "samples/addons/kiali.yaml": no matches for kind "MonitoringDashboard" in version "monitoring.kiali.io/v1alpha1"
unable to recognize "samples/addons/kiali.yaml": no matches for kind "MonitoringDashboard" in version "monitoring.kiali.io/v1alpha1"
unable to recognize "samples/addons/kiali.yaml": no matches for kind "MonitoringDashboard" in version "monitoring.kiali.io/v1alpha1"
unable to recognize "samples/addons/kiali.yaml": no matches for kind "MonitoringDashboard" in version "monitoring.kiali.io/v1alpha1"
unable to recognize "samples/addons/kiali.yaml": no matches for kind "MonitoringDashboard" in version "monitoring.kiali.io/v1alpha1"
unable to recognize "samples/addons/kiali.yaml": no matches for kind "MonitoringDashboard" in version "monitoring.kiali.io/v1alpha1"
unable to recognize "samples/addons/kiali.yaml": no matches for kind "MonitoringDashboard" in version "monitoring.kiali.io/v1alpha1"
unable to recognize "samples/addons/kiali.yaml": no matches for kind "MonitoringDashboard" in version "monitoring.kiali.io/v1alpha1"
unable to recognize "samples/addons/kiali.yaml": no matches for kind "MonitoringDashboard" in version "monitoring.kiali.io/v1alpha1"
unable to recognize "samples/addons/kiali.yaml": no matches for kind "MonitoringDashboard" in version "monitoring.kiali.io/v1alpha1"
unable to recognize "samples/addons/kiali.yaml": no matches for kind "MonitoringDashboard" in version "monitoring.kiali.io/v1alpha1"
unable to recognize "samples/addons/kiali.yaml": no matches for kind "MonitoringDashboard" in version "monitoring.kiali.io/v1alpha1"
unable to recognize "samples/addons/kiali.yaml": no matches for kind "MonitoringDashboard" in version "monitoring.kiali.io/v1alpha1"
unable to recognize "samples/addons/kiali.yaml": no matches for kind "MonitoringDashboard" in version "monitoring.kiali.io/v1alpha1"

[root@master01 istio-1.8.2]# kubectl rollout status deployment/kiali -n istio-system
Waiting for deployment "kiali" rollout to finish: 0 of 1 updated replicas are available...
deployment "kiali" successfully rolled out

[root@master01 istio-1.8.2]# istioctl dashboard kiali --address <Accessable IP ADDR>
http://localhost:20001/kiali
Failed to open browser; open http://localhost:20001/kiali in your browser.

반응형