WorkloadEntry
apiVersion: networking.istio.io/v1alpha3
kind: WorkloadEntry
metadata:
name: vm1
namespace: ns1
spec:
address: 1.1.1.1
labels:
app: foo
instance-id: vm-78ad2
class: vm
---
apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
name: svc1
namespace: ns1
spec:
hosts:
- svc1.internal.com
ports:
- number: 80
name: http
protocol: HTTP
resolution: STATIC
workloadSelector:
labels:
app: foo
VM自動(dòng)注冊
在安裝istiod的時(shí)候,啟用自動(dòng)注冊的功能。
$ istioctl install --set values.pilot.env.PILOT_ENABLE_WORKLOAD_ENTRY_AUTOREGISTRATION=true
部署一個(gè)east-west gateway。用于暴露istiod服務(wù),從而可以讓VM上的Sidecar 可以和istiod 通信。
apiVersion: networking.istio.io/v1alpha3
kind: WorkloadGroup
metadata:
name: python-http
namespace: vm
spec:
metadata:
annotations: {}
labels:
app: python-http
template:
ports: {}
serviceAccount: my-vm
apiVersion: networking.istio.io/v1beta1
kind: ServiceEntry
metadata:
name: vm-workload-svc
namespace: vm
spec:
hosts:
- vmservice.example.com
location: MESH_INTERNAL
ports:
- number: 80
name: http
protocol: HTTP
targetPort: 9090
resolution: STATIC
workloadSelector:
labels:
app: python-http
智能DNS
--set meshConfig.defaultConfig.proxyMetadata.ISTIO_META_DNS_CAPTURE=true