istio 관리툴인 istioctl을 설치한다.
$ arch -arm64 brew install istioctl
$ curl -sL https://istio.io/downloadIstioctl | ISTIO_VERSION=1.10.3 TARGET_ARCH=x86_64 sh -
curl 을 통해서 istio 다운로드시
istioctl
과 istio 설치에 필요한 helm manifest 와 profile 을 확인 할 수 있다.
istioctl을 통해서 k8s 클러스터에 Istio 를 설치한다.
istio는 미리 정의된 config profile을 통해 어떤 component를 설치할 지 선택 할 수 있다.
✏️ istio v1.7부터 Add-on(kiali, Jaeger, Prometheus) 사용자가 직접 설치해야 한다.
> istio profile 확인
$ istioctl profile list
> 특정 profile 설치
egress, ingress, istiod 모두 설치되는 demo
를 설치한다.
$ istioctl install --set profile=demo
> 설치한 istio 제거
$ istioctl uninstall --purge
profile=demo 설치시 기본으로 ingress-gateway 는 AWS 기준 로드밸런서는 "classic" 으로 생성된다. 그러나 우리는 "network" 타입으로 사용할 것이기 때문에 별도의 작업이 필요하다.
profile:demo yaml을 수정하고 해당내용 반영하기 위해서 istioctl 없이 Kubectl을 사용하는 방법으로 진행한다. 그리고 실제 Istio 설치 환경에서 kubectl 만으로 조작하기 위함.
위에서 다운받은 yaml 대상으로 kubectl 하면 에러가 발생한다.
이는 istioctl
으로만 인식가능하기 때문이다. 그렇기 때문에 k8s 에서 인식할 수 있도록 변환작업이 필요하다.
# STEP 1. istio demo profile을 dump하여 파일로 생성
$ istioctl profile dump demo > raw_demo_profile.yaml
# STEP 2. 설정 변경 (nlb 사용 옵션 추가)
$ vi raw_demo_profile.yaml
rawdemo_profile.yaml
**_serviceAnnotations:
service.beta.kubernetes.io/aws-load-balancer-type: nlb**
apiVersion: install.istio.io/v1alpha1
kind: IstioOperator
spec:
components:
base:
enabled: true
cni:
enabled: false
egressGateways:
- enabled: true
k8s:
resources:
requests:
cpu: 10m
memory: 40Mi
name: istio-egressgateway
ingressGateways:
- enabled: true
k8s:
resources:
requests:
cpu: 10m
memory: 40Mi
service:
ports:
- name: status-port
port: 15021
targetPort: 15021
- name: http2
port: 80
targetPort: 8080
- name: https
port: 443
targetPort: 8443
- name: tcp
port: 31400
targetPort: 31400
- name: tls
port: 15443
targetPort: 15443
serviceAnnotations:
service.beta.kubernetes.io/aws-load-balancer-type: nlb
name: istio-ingressgateway
istiodRemote:
enabled: false
pilot:
enabled: true
k8s:
env:
- name: PILOT_TRACE_SAMPLING
value: "100"
resources:
requests:
cpu: 10m
memory: 100Mi
hub: docker.io/istio
meshConfig:
accessLogFile: /dev/stdout
defaultConfig:
proxyMetadata: {}
enablePrometheusMerge: true
extensionProviders:
- envoyOtelAls:
port: 4317
service: opentelemetry-collector.istio-system.svc.cluster.local
name: otel
profile: demo
tag: 1.16.0
values:
base:
enableCRDTemplates: false
validationURL: ""
defaultRevision: ""
gateways:
istio-egressgateway:
autoscaleEnabled: false
env: {}
name: istio-egressgateway
secretVolumes:
- mountPath: /etc/istio/egressgateway-certs
name: egressgateway-certs
secretName: istio-egressgateway-certs
- mountPath: /etc/istio/egressgateway-ca-certs
name: egressgateway-ca-certs
secretName: istio-egressgateway-ca-certs
type: ClusterIP
istio-ingressgateway:
autoscaleEnabled: false
env: {}
name: istio-ingressgateway
secretVolumes:
- mountPath: /etc/istio/ingressgateway-certs
name: ingressgateway-certs
secretName: istio-ingressgateway-certs
- mountPath: /etc/istio/ingressgateway-ca-certs
name: ingressgateway-ca-certs
secretName: istio-ingressgateway-ca-certs
type: LoadBalancer
global:
configValidation: true
defaultNodeSelector: {}
defaultPodDisruptionBudget:
enabled: true
defaultResources:
requests:
cpu: 10m
imagePullPolicy: ""
imagePullSecrets: []
istioNamespace: istio-system
istiod:
enableAnalysis: false
jwtPolicy: third-party-jwt
logAsJson: false
logging:
level: default:info
meshNetworks: {}
mountMtlsCerts: false
multiCluster:
clusterName: ""
enabled: false
network: ""
omitSidecarInjectorConfigMap: false
oneNamespace: false
operatorManageWebhooks: false
pilotCertProvider: istiod
priorityClassName: ""
proxy:
autoInject: enabled
clusterDomain: cluster.local
componentLogLevel: misc:error
enableCoreDump: false
excludeIPRanges: ""
excludeInboundPorts: ""
excludeOutboundPorts: ""
image: proxyv2
includeIPRanges: '*'
logLevel: warning
privileged: false
readinessFailureThreshold: 30
readinessInitialDelaySeconds: 1
readinessPeriodSeconds: 2
resources:
limits:
cpu: 2000m
memory: 1024Mi
requests:
cpu: 10m
memory: 40Mi
statusPort: 15020
tracer: zipkin
proxy_init:
image: proxyv2
resources:
limits:
cpu: 2000m
memory: 1024Mi
requests:
cpu: 10m
memory: 10Mi
sds:
token:
aud: istio-ca
sts:
servicePort: 0
tracer:
datadog: {}
lightstep: {}
stackdriver: {}
zipkin: {}
useMCP: false
istiodRemote:
injectionURL: ""
pilot:
autoscaleEnabled: false
autoscaleMax: 5
autoscaleMin: 1
configMap: true
cpu:
targetAverageUtilization: 80
enableProtocolSniffingForInbound: true
enableProtocolSniffingForOutbound: true
env: {}
image: pilot
keepaliveMaxServerConnectionAge: 30m
nodeSelector: {}
podLabels: {}
replicaCount: 1
traceSampling: 1
telemetry:
enabled: true
v2:
enabled: true
metadataExchange:
wasmEnabled: false
prometheus:
enabled: true
wasmEnabled: false
stackdriver:
configOverride: {}
enabled: false
logging: false
monitoring: false
topology: false
# STEP 3. dump 받은 파일을 k8s yaml 로 변환
$ istioctl manifest generate -f raw_demo_profile.yaml > k8s_raw_demo_profile.yaml
# STEP 4. kubectl 로 실행
$ kubectl apply -f k8s_raw_demo_profile.yaml
위와 같이 k8s yaml 로 변경하여 설치할 경우 CRD - EnvoyFilter
가 제대로 설치되지 않는문제를 발견하였다.
no matches for kind "EnvoyFilter" in version "networking.istio.io/v1alpha3"
그래서 다시 istioctl로 nlb를 설정하는 방법을 찾아보려고 한다.
(시간있을때 다시 찾아봐야지.....뚀륵...)
serviceAnnotations:
service.beta.kubernetes.io/aws-load-balancer-type: "nlb"
service.beta.kubernetes.io/aws-load-balancer-internal: "true"
istioctl install --set profile=demo --charts=./manifests/
하지만 나는 cluster > job 에서 수행해야 하는데 istioctl 만 설치할 순 없나...?
파일 copy해서 수행하니까 실행파일인지 인식을 못하는것 같다...미춰버리겠네 ㅠㅠ
아무래도 istioctl 사용하기에는 무리인것 같고...해서 kubernetes 용으로 만들어진 yaml을 세부분으로 분리해서 순서대로 설치해보기로 했다.
1. CustomResource yaml
2. CustomResource:EnvoyFilter yaml
3. 나머지 istio yaml
이렇게 하니까 된다!!!???? 어이없어..하..
CRD 먼저 생성하여 EnvoyFilter 설치시 CRD 가 존재하도록 하고 나머지 istio 리소스를 설치하도록하면 되지않을까해서 해본 방법..
산넘어 산~~ 다음은 addon으로 설치한 서비스들 외부접속 허용되도록 수정해야한다! 🤯