README.adoc 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. # Spring Cloud Gateway for Kubernetes
  2. * make sure you have Docker running
  3. * install Kind and a local registry in your local machine. You can use the provided script:
  4. ```shell
  5. $ ./infrastructure/start-kind-registry.sh
  6. ```
  7. * provided also the options to use either contour or ambassador ingress controller. Use either one of the following scripts to configure an ingress controller in Kind cluster. If you use contour ingress controller, then edit the
  8. ingress YAML file `./k8s/install-ingress.yml` and make sure you use `ingressClassName: contour`, otherwise it should be
  9. `ingressClassName: embassador`.
  10. ```shell
  11. $ ./infrastructure/config-contour-ingress.sh
  12. ```
  13. or
  14. ```shell
  15. $ ./infrastructure/config-ambassador-ingress.sh
  16. ```
  17. ## Automatic
  18. You can use the provided script `./k8s/setup.sh` to deploy SCG for k8s, a workload gateway instance
  19. configured with routes, deploy the services and ingress. In the script, replace the variable `installer_dir`
  20. to point to a directory where you extract SCG for k8s installer. The installer could be downloaded from
  21. https://docs.pivotal.io/scg-k8s/1-0/installation.html[here]. You can follow the steps below to perform
  22. all steps manually.
  23. ## Manual
  24. * follow the instructions https://docs.pivotal.io/scg-k8s/1-0/installation.html[here] to install Spring Cloud Gateway for Kubernetes.
  25. ** per the instructions: to relocate the images do the following (installer_dir is where you extract SCG for K8s installer)
  26. ```shell
  27. $ {installer_dir}/scripts/relocate-images.sh localhost:5000
  28. ```
  29. ** then run the installation
  30. ```shell
  31. $ {installer_dir}/script/install-spring-cloud-gateway.sh
  32. ```
  33. * create a gateway instance:
  34. ```shell
  35. $ kubectl apply -f ./k8s/install-gateway.yml
  36. ```
  37. * create gateway route configuration:
  38. ```shell
  39. $ kubectl apply -f ./k8s/install-gateway-routes-config.yml
  40. ```
  41. * create gateway route configuration and mappings:
  42. ```shell
  43. $ kubectl apply -f ./k8s/install-gateway-mappings.yml
  44. ```
  45. * build the project to create and push the images to the local registry. The plugin should create and push the image automatically by running this command (on the project root folder)
  46. ```shell
  47. $ ./mvnw spring-boot:build-image
  48. ```
  49. * install the frontend and backend services
  50. ```shell
  51. $ kubectl apply -f ./k8s/install-services.yml
  52. ```
  53. * create ingress
  54. ```shell
  55. $ kubectl apply -f ./k8s/install-ingress.yml
  56. ```
  57. * test by accessing the frontend service through ingress
  58. ```shell
  59. $ curl http://localhost:80/frontend/
  60. ```