This post gives the guide how to integrate apisix-mesh-agent into Istio mesh.
Just use any Kubernetes cluster that you want, if you don't have an existing one in your hand, we recommend you to use Kind to build a Kubernetes cluster for development quickly, you can run the following commands to set up and clean a Kubernetes cluster with a Docker Registry.
cd /path/to/apisix-mesh-agent
make kind-up
make kind-reset
In this post, we use Helm 3 to install Istio. You should download the desired Istio release version to your local environment. In this document, we use istio/1.9.1.
In this post, we use the typical istio-system
as the istio root namespace.
kubectl create namespace istio-system
export DOCKER_IMAGE_TAG=dev
export DOCKER_IMAGE_REGISTRY=localhost:5000
cd /path/to/apisix-mesh-agent
make build-image
docker tag api7/apisix-mesh-agent:$DOCKER_IMAGE_TAG $DOCKER_IMAGE_REGISTRY/api7/apisix-mesh-agent:$DOCKER_IMAGE_TAG
docker push $DOCKER_IMAGE_REGISTRY/api7/apisix-mesh-agent:$DOCKER_IMAGE_TAG
The above commands build the image firstly and push the image to the target image registry (change the DOCKER_IMAGE_REGISTRY
to your desired one). You should have docker installed in the running environment.
Note:
You should change the value of DOCKER_IMAGE_REGISTRY to the actual image registry address that you're using.
Your image registry should be accessible from the Kubernetes cluster.
cd /path/to/istio/manifests
helm install istio-base \
--namespace istio-system \
./charts/base
istio-base chart contains several resources which are required for running istiod
.
Before you execute the above commands, be sure you've cloned istio to your local.
export ISTIO_RELEASE=1.9.1
cd /path/to/istio/manifests
cp /path/to/apisix-mesh-agent/manifests/istio/injection-template.yaml charts/istio-control/istio-discovery/files/
helm install istio-discovery \
--namespace istio-system \
--set pilot.image=istio/pilot:$ISTIO_RELEASE \
--set global.proxy.privileged=true \
--set global.proxy_init.hub=$DOCKER_IMAGE_REGISTRY \
--set global.proxy_init.image=api7/apisix-mesh-agent \
--set global.proxy_init.tag=dev \
--set global.proxy.hub=$DOCKER_IMAGE_REGISTRY \
--set global.proxy.image=api7/apisix-mesh-agent \
--set global.proxy.tag=dev \
./charts/istio-control/istio-discovery
We changed the injection template to injection-template.yaml as we want to change the sidecar from Envoy to apisix-mesh-agent.
Please make sure memory is enough as by default Istios requests
2G
memory, if that's expensive in your Kubernetes cluster, changing the resources configuration by specifying:--set pilot.resources.requests.memory=<reasonable memory size>
.
kubectl create namespace test
kubectl run nginx --image=nginx -n test --port 80
Wait for a while and check out the pod status, the sidecar container should be injected into the nginx pod.
kubectl get pods -n test
NAME READY STATUS RESTARTS AGE
nginx 2/2 Running 0 53s
For further learning, please read tiny-service-mesh-scenario, so you can know how to verify this mesh by sending requests.
helm uninstall istio-discovery --namespace istio-system
helm uninstall istio-base --namespace istio-system
kubectl delete namespace istio-system