2.14.
2.14.1. 링크 복사링크가 클립보드에 복사되었습니다!
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: ext-host-gwy
spec:
selector:
istio: ingressgateway # use istio default controller
servers:
- port:
number: 443
name: https
protocol: HTTPS
hosts:
- ext-host.example.com
tls:
mode: SIMPLE
serverCertificate: /tmp/tls.crt
privateKey: /tmp/tls.key
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: virtual-svc
spec:
hosts:
- ext-host.example.com
gateways:
- ext-host-gwy
2.14.1.1. 링크 복사링크가 클립보드에 복사되었습니다!
2.14.1.2. 링크 복사링크가 클립보드에 복사되었습니다!
apiVersion: v1 kind: Service metadata: name: istio-ingressgateway namespace: istio-ingress spec: type: ClusterIP selector: istio: ingressgateway ports: - name: http2 port: 80 targetPort: 8080 - name: https port: 443 targetPort: 8443 --- apiVersion: apps/v1 kind: Deployment metadata: name: istio-ingressgateway namespace: istio-ingress spec: selector: matchLabels: istio: ingressgateway template: metadata: annotations: inject.istio.io/templates: gateway labels: istio: ingressgateway sidecar.istio.io/inject: "true"1 spec: containers: - name: istio-proxy image: auto2 apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: name: istio-ingressgateway-sds namespace: istio-ingress rules: - apiGroups: [""] resources: ["secrets"] verbs: ["get", "watch", "list"] --- apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: istio-ingressgateway-sds namespace: istio-ingress roleRef: apiGroup: rbac.authorization.k8s.io kind: Role name: istio-ingressgateway-sds subjects: - kind: ServiceAccount name: defaultapiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: gatewayingress namespace: istio-ingress spec: podSelector: matchLabels: istio: ingressgateway ingress: - {} policyTypes: - IngressapiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: labels: istio: ingressgateway release: istio name: ingressgatewayhpa namespace: istio-ingress spec: maxReplicas: 5 metrics: - resource: name: cpu target: averageUtilization: 80 type: Utilization type: Resource minReplicas: 2 scaleTargetRef: apiVersion: apps/v1 kind: Deployment name: istio-ingressgatewayapiVersion: policy/v1 kind: PodDisruptionBudget metadata: labels: istio: ingressgateway release: istio name: ingressgatewaypdb namespace: istio-ingress spec: minAvailable: 1 selector: matchLabels: istio: ingressgateway
2.14.1.3. 링크 복사링크가 클립보드에 복사되었습니다!
2.14.1.3.1. 링크 복사링크가 클립보드에 복사되었습니다!
$ oc get svc istio-ingressgateway -n istio-system
2.14.1.3.1.1. 링크 복사링크가 클립보드에 복사되었습니다!
$ export INGRESS_HOST=$(oc -n istio-system get service istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip}')$ export INGRESS_PORT=$(oc -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http2")].port}')$ export SECURE_INGRESS_PORT=$(oc -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="https")].port}')$ export TCP_INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="tcp")].port}')
$ export INGRESS_HOST=$(oc -n istio-system get service istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].hostname}')
2.14.1.3.1.2. 링크 복사링크가 클립보드에 복사되었습니다!
$ export INGRESS_PORT=$(oc -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http2")].nodePort}')$ export SECURE_INGRESS_PORT=$(oc -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="https")].nodePort}')$ export TCP_INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="tcp")].nodePort}')
2.14.1.4. 링크 복사링크가 클립보드에 복사되었습니다!
apiVersion: networking.istio.io/v1alpha3 kind: Gateway metadata: name: info-gateway spec: selector: istio: ingressgateway servers: - port: number: 80 name: http protocol: HTTP hosts: - "*"$ oc apply -f gateway.yaml
apiVersion: networking.istio.io/v1alpha3 kind: VirtualService metadata: name: info spec: hosts: - "*" gateways: - info-gateway http: - match: - uri: exact: /productpage - uri: prefix: /static - uri: exact: /login - uri: exact: /logout - uri: prefix: /api/v1/products route: - destination: host: productpage port: number: 9080$ oc apply -f vs.yaml
export GATEWAY_URL=$(oc -n istio-system get route istio-ingressgateway -o jsonpath='{.spec.host}')export TARGET_PORT=$(oc -n istio-system get route istio-ingressgateway -o jsonpath='{.spec.port.targetPort}')curl -s -I "$GATEWAY_URL/productpage"
2.14.2. 링크 복사링크가 클립보드에 복사되었습니다!
2.14.2.1. 링크 복사링크가 클립보드에 복사되었습니다!
2.14.2.2. 링크 복사링크가 클립보드에 복사되었습니다!
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: gateway1
spec:
selector:
istio: ingressgateway
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- www.info.com
- info.example.com
$ oc -n istio-system get routes
NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD
gateway1-lvlfn info.example.com istio-ingressgateway <all> None
gateway1-scqhv www.info.com istio-ingressgateway <all> None
2.14.2.3. 링크 복사링크가 클립보드에 복사되었습니다!
2.14.2.4. 링크 복사링크가 클립보드에 복사되었습니다!
2.14.2.4.1. 링크 복사링크가 클립보드에 복사되었습니다!
2.14.2.4.2. 링크 복사링크가 클립보드에 복사되었습니다!
apiVersion: maistra.io/v1alpha1
kind: ServiceMeshControlPlane
metadata:
namespace: istio-system
spec:
gateways:
openshiftRoute:
enabled: false
2.14.3. 링크 복사링크가 클립보드에 복사되었습니다!
apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
name: svc-entry
spec:
hosts:
- ext-svc.example.com
ports:
- number: 443
name: https
protocol: HTTPS
location: MESH_EXTERNAL
resolution: DNS
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: ext-res-dr
spec:
host: ext-svc.example.com
trafficPolicy:
tls:
mode: MUTUAL
clientCertificate: /etc/certs/myclientcert.pem
privateKey: /etc/certs/client_private_key.pem
caCertificates: /etc/certs/rootcacerts.pem
2.14.4. 링크 복사링크가 클립보드에 복사되었습니다!
2.14.4.1. 링크 복사링크가 클립보드에 복사되었습니다!
apiVersion: networking.istio.io/v1alpha3 kind: VirtualService metadata: name: reviews spec: hosts: - reviews http: - match: - headers: end-user: exact: jason route: - destination: host: reviews subset: v2 - route: - destination: host: reviews subset: v3$ oc apply -f <VirtualService.yaml>
2.14.4.2. 링크 복사링크가 클립보드에 복사되었습니다!
|
|
|
|
|
|
2.14.5. 링크 복사링크가 클립보드에 복사되었습니다!
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: my-destination-rule
spec:
host: my-svc
trafficPolicy:
loadBalancer:
simple: RANDOM
subsets:
- name: v1
labels:
version: v1
- name: v2
labels:
version: v2
trafficPolicy:
loadBalancer:
simple: ROUND_ROBIN
- name: v3
labels:
version: v3
2.14.6. 링크 복사링크가 클립보드에 복사되었습니다!
2.14.6.1. 링크 복사링크가 클립보드에 복사되었습니다!
apiVersion: maistra.io/v2 kind: ServiceMeshControlPlane spec: security: manageNetworkPolicy: false
2.14.7. 링크 복사링크가 클립보드에 복사되었습니다!
apiVersion: networking.istio.io/v1alpha3 kind: Sidecar metadata: name: default namespace: info spec: egress: - hosts: - "./*" - "istio-system/*"$ oc apply -f sidecar.yaml$ oc get sidecar
2.14.8. 링크 복사링크가 클립보드에 복사되었습니다!
2.14.8.1. 링크 복사링크가 클립보드에 복사되었습니다!
2.14.8.2. 링크 복사링크가 클립보드에 복사되었습니다!
$ oc apply -f https://raw.githubusercontent.com/Maistra/istio/maistra-2.6/samples/info/networking/virtual-service-all-v1.yaml$ oc get virtualservices -o yaml
2.14.8.3. 링크 복사링크가 클립보드에 복사되었습니다!
export GATEWAY_URL=$(oc -n istio-system get route istio-ingressgateway -o jsonpath='{.spec.host}')echo "http://$GATEWAY_URL/productpage"
2.14.8.4. 링크 복사링크가 클립보드에 복사되었습니다!
$ oc apply -f https://raw.githubusercontent.com/Maistra/istio/maistra-2.6/samples/info/networking/virtual-service-reviews-test-v2.yaml$ oc get virtualservice reviews -o yaml