以下、導入手順:
curl -L https://istio.io/downloadIstio | sh -
cd istio-1.25.0
export PATH=$PWD/bin:$PATH
istioctl install -set profile=default
ingress gatewayが入っていることを確認:
selecortのapp=istio-ingressgatewayまたは
istio=ingressgatewayを以下の
spec.selector:に記載すること(今回は、app=istio-ingressgatewayにする)
ingress gatewayのマニフェストを作成:
apiVersion: networking.istio.io/v1beta1
kind: Gateway
metadata:
name: nginx-gateway
namespace: default
spec:
selector:
app: istio-ingressgateway # Istio Ingress Gateway のデフォルトラベル
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- "*"
---
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: nginx-vs
namespace: default
spec:
hosts:
- "*"
gateways:
- nginx-gateway
http:
- match:
- uri:
prefix: / # nginx.default.svc.cluster.local<----完全修飾サービス名にするアクセスできず。
route:
- destination:
host: nginx
port:
number: 80
---
# nginx Deployment と Service の作成
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:latest
ports:
- containerPort: 80
resources:
limits:
memory: "512Mi" # コンテナが使用できる最大メモリ
cpu: "500m" # コンテナが使用できる最大CPU
requests:
memory: "256Mi" # コンテナに最低限必要なメモリ
cpu: "250m" # コンテナに最低限必要なCPU
---
apiVersion: v1
kind: Service
metadata:
name: nginx
namespace: default
spec:
ports:
- port: 80
targetPort: 80
selector:
app: nginx
0 件のコメント:
コメントを投稿