dubbo-pilot Control Plane Deployment

dubbo-pilot Control Plane Deployment

1 Overall Goals

  • Compile the control plane and build images
  • Deploy using istioctl in a Kubernetes environment
  • How to debug the control plane program

2 Basic Process

This example will demonstrate how to compile the dubbo-pilot control plane and how to deploy it using istioctl in a Kubernetes environment.

  1. Start the control plane locally, and debug dubbo-pilot.
  2. Use istioctl for starting and debugging in the k8s environment.

3 Detailed Steps

3.1 Environment Requirements

  • Golang
  • Docker
  • Minikube/Kind
  • Kubectl
  • Dlv

3.2 Local Deployment

3.2.1 Compilation

  1. Compile the docker-builder
  1. cd dubbo-go-pixiu/tools/docker-builder && go install
  2. docker-builder -h:
  3. Builds Istio docker images
  4. Usage:
  5. [flags]
  6. Flags:
  7. --architecures strings architectures to build (default [linux/amd64])
  8. --base-version string base version to use (default "latest")
  9. --builder string type of builder to use. options are crane or docker (default "docker")
  10. -h, --help help for this command
  11. --hub strings docker hub(s) (default [localhost:5000])
  12. --istio-version string istio version to use (default "1.14-dev")
  13. --kind-load kind cluster to load into
  14. --no-cache disable caching
  15. --no-clobber do not allow pushing images that already exist
  16. --proxy-version string proxy version to use (default "7ae8e27f274b33dc2f4d83100aea5971ed6698d3")
  17. --push push targets to registry
  18. --save save targets to tar.gz
  19. --tag strings docker tag(s) (default [latest])
  20. --targets strings targets to build (default [app,app_sidecar_centos_7,app_sidecar_debian_11,app_sidecar_ubuntu_jammy,app_sidecar_ubuntu_xenial,ext-authz,install-cni,istioctl,operator,pilot,proxyv2])
  21. --variants strings variants to build (default [default])
  22. --version show build version
  1. Use docker-builder to automatically compile and build the image

Compile istioctl

  1. docker-builder --targets istioctl
  2. Compilation completed:
  3. ls out/linux_amd64/
  4. istioctl logs pilot-agent pilot-discovery

Compile dubbo-pilot and push to private image repository

  1. tools/docker-builder/docker-builder --targets pilot --hub docker.io/bobtthp --push

3.2.2 Local Deployment

Local start method:

  1. ./out/linux_amd64/pilot-discovery
  2. Startup log:
  3. 2022-09-24T15:31:56.751245Z info FLAG: --caCertFile=""
  4. 2022-09-24T15:31:56.751277Z info FLAG: --clusterAliases="[]"
  5. 2022-09-24T15:31:56.751280Z info FLAG: --clusterID="Kubernetes"
  6. 2022-09-24T15:31:56.751282Z info FLAG: --clusterRegistriesNamespace="istio-system"
  7. 2022-09-24T15:31:56.751284Z info FLAG: --configDir=""
  8. 2022-09-24T15:31:56.751286Z info FLAG: --ctrlz_address="localhost"
  9. 2022-09-24T15:31:56.751289Z info FLAG: --ctrlz_port="9876"
  10. 2022-09-24T15:31:56.751291Z info FLAG: --domain="cluster.local"
  11. ...
  12. 2022-09-24T15:31:56.753814Z info initializing mesh configuration ./etc/istio/config/mesh

3.3 Container Deployment

3.3.1 Image Building

Build remote debug image

  1. Download dlv
  1. git clone https://github.com/go-delve/delve.git
  2. make install
  3. which dlv
  4. /root/go/bin/dlv
  1. Add dlv to Dockerfile in dubbo-go-pixiu/pilot/docker/Dockerfile.pilot:
  1. COPY ${TARGETARCH:-amd64}/dlv /usr/local/bin/dlv
  1. Copy dlv to the image mount directory:
  1. cp /root/go/bin/dlv out/linux_amd64/dockerx_build/build.docker.pilot/amd64/
  1. Build and push the debug image:
  1. docker-builder --targets pilot --hub docker.io/bobtthp --push --tag debug
  1. You can also check the image build status locally:
  1. [root~master-1] /tmp/dubbo-go-pixiu/tools/docker-builder> docker images
  2. REPOSITORY TAG IMAGE ID CREATED SIZE
  3. bobtthp/pilot latest 7b1aadd55120 13 minutes ago 262MB

3.3.2 Deployment

  1. Deploy using the newly built image:
  1. out/linux_amd64/istioctl --set .values.pilot.image=bobtthp/pilot:debug install
  1. Check the deployment status:
  1. [root~master] /tmp/dubbo-go-pixiu/tools/docker-builder> kubectl get po -n istio-system
  2. NAME READY STATUS RESTARTS AGE
  3. istiod-fd5d9f77-2ncjq 1/1 Running 0 18m
  1. Enter the container for remote debugging:
  1. [root~master-1] /tmp/dubbo-go-pixiu> kubectl exec -it -n istio-system istiod-fd5d9f77-2ncjq bash
  2. kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl exec [POD] -- [COMMAND] instead.
  1. Start dlv:
  1. istio-proxy@istiod-fd5d9f77-2ncjq:/$ dlv --listen=:8015 --headless=true --api-version=2 --log attach `ps -ef |grep pilot-discovery| awk '{print $2}'`
  2. 2022-11-04T15:43:14Z error layer=debugger could not create config directory: mkdir /home/istio-proxy/.config: read-only file system
  3. API server listening at: [::]:8015
  4. 2022-11-04T15:43:14Z warning layer=rpc Listening for remote connections (connections are not authenticated nor encrypted)
  5. 2022-11-04T15:43:14Z info layer=debugger attaching to pid 1
  1. Expose ports:
  1. [root~master-1] /tmp> kubectl port-forward -n istio-system istiod-fd5d9f77-2ncjq 8015:8015
  2. Forwarding from 127.0.0.1:8015 -> 8015
  3. Forwarding from [::1]:8015 -> 8015
  1. Remote debugging is now possible.

Feedback

Was this page helpful?

Yes No

Last modified September 30, 2024: Update & Translate Overview Docs (#3040) (d37ebceaea7)