Configurare ingress nginx con Milvus
Questo argomento illustra come configurare ingress nginx con Milvus. Per maggiori dettagli, consultare ingress-nginx.
Configurazione di ingress nginx
- Impostare env.
export DNS_LABEL="milvustest" # Your DNS label must be unique within its Azure location.
export NAMESPACE="ingress-basic"
- Installare ingress nginx
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm repo update
helm install ingress-nginx ingress-nginx/ingress-nginx \
--create-namespace \
--namespace $NAMESPACE \
--set controller.service.annotations."service\.beta\.kubernetes\.io/azure-dns-label-name"=$DNS_LABEL \
--set controller.service.annotations."service\.beta\.kubernetes\.io/azure-load-balancer-health-probe-request-path"=/healthz
- Ottenere l'indirizzo IP esterno.
kubectl --namespace $NAMESPACE get services -o wide -w ingress-nginx-controller
- Configurare un FQDN per il controller di ingress.
# Public IP address of your ingress controller
IP="MY_EXTERNAL_IP"
# Get the resource-id of the public IP
PUBLICIPID=$(az network public-ip list --query "[?ipAddress!=null]|[?contains(ipAddress, '$IP')].[id]" --output tsv)
# Update public IP address with DNS name
az network public-ip update --ids $PUBLICIPID --dns-name $DNS_LABEL
# Display the FQDN
az network public-ip show --ids $PUBLICIPID --query "[dnsSettings.fqdn]" --output tsv
# sample output: milvustest.eastus2.cloudapp.azure.com
Installare cert-manager
helm repo add jetstack https://charts.jetstack.io
helm repo update
helm install cert-manager jetstack/cert-manager \
--namespace $NAMESPACE \
--set installCRDs=true
Creare un emittente di cluster di CA
- Creare un emittente del cluster, come cluster-issuer.yaml, usando il seguente esempio di manifest. Sostituire MY_EMAIL_ADDRESS con un indirizzo valido della propria organizzazione.
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: letsencrypt
spec:
acme:
server: https://acme-v02.api.letsencrypt.org/directory
email: MY_EMAIL_ADDRESS
privateKeySecretRef:
name: letsencrypt
solvers:
- http01:
ingress:
class: nginx
- Applicare l'emittente con il comando kubectl apply.
kubectl apply -f cluster-issuer.yaml
Distribuire Milvus
fare riferimento ad Azure, notare il valore config service.type
, che deve essere modificato in ClusterIP
.
Creare la rotta di ingresso di Milvus
kubectl apply -f ingress.yaml
il contenuto di ingress.yaml:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: my-release-milvus
annotations:
cert-manager.io/cluster-issuer: letsencrypt
nginx.ingress.kubernetes.io/backend-protocol: GRPC
nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
nginx.ingress.kubernetes.io/proxy-body-size: 2048m
spec:
ingressClassName: nginx
tls:
- hosts:
- milvustest.eastus2.cloudapp.azure.com # the FQDN
secretName: tls-secret
rules:
- host: milvustest.eastus2.cloudapp.azure.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: my-release-milvus
port:
number: 19530
Verificare
kubectl get certificate
NAME READY SECRET AGE
tls-secret True tls-secret 8m7s
kubectl get ingress
NAME CLASS HOSTS ADDRESS PORTS AGE
my-release-milvus nginx milvustest.eastus2.cloudapp.azure.com EXTERNAL-IP 80, 443 8m15s
Ciao Milvus
Fare riferimento a Hello Milvus, modificare gli argomenti di uri, quindi eseguire il codice.
connections.connect("default",uri="https://milvustest.eastus2.cloudapp.azure.com:443")