github.com/GoogleContainerTools/skaffold@v1.39.18/examples/multi-config-microservices/README.md (about) 1 ### Example: Multiple configs µSvcs with Skaffold 2 3 [![Open in Cloud Shell](https://gstatic.com/cloudssh/images/open-btn.svg)](https://ssh.cloud.google.com/cloudshell/editor?cloudshell_git_repo=https://github.com/GoogleContainerTools/skaffold&cloudshell_open_in_editor=README.md&cloudshell_workspace=examples/multi-config-microservices) 4 5 In this example: 6 7 * Deploy microservice applications individually or in a group. 8 * Compose multiple skaffold configs together in a single config. 9 10 In the real world, Kubernetes deployments will consist of multiple applications that work together. These applications may not necessarily live in the same repository, and it might be difficult to define a single `skaffold.yaml` configuration to describe all these disparate applications together. 11 12 Skaffold solves this problem by allowing each application to define its own `skaffold.yaml` configuration file that is only scoped to that specific app. These related configs can also be grouped together into another `skaffold.yaml` config when needed. 13 14 In this example, we'll walk through using skaffold to develop and deploy two applications, an exposed "web" frontend which calls an unexposed "app" backend. 15 16 **WARNING: If you're running this on a cloud cluster, this example will create a service and expose a webserver. 17 It's highly suggested that you only run this example on a local, private cluster like minikube or Kubernetes in Docker for Desktop.** 18 19 #### Running the example on minikube 20 21 From the `multi-config-microservices/leeroy-app` directory, run 22 23 ```bash 24 skaffold dev 25 ``` 26 27 Now, in a different terminal, from the `multi-config-microservices/leeroy-web` directory, again run 28 29 ```bash 30 skaffold dev 31 ``` 32 33 Now, in a different terminal, hit the `leeroy-web` endpoint 34 35 ```bash 36 $ curl $(minikube service leeroy-web --url) 37 leeroooooy app! 38 ``` 39 40 These are two independently managed instances of Skaffold running on the `leeroy-app` and `leeroy-web` applications. Hitting `Ctrl + C` on each should kill the process and clean up the deployments. 41 42 In order to iterate on both apps together we reference them as **required** configs in the `multi-config-microservices/skaffold.yaml` file. 43 44 ```yaml 45 apiVersion: skaffold/v2beta11 46 kind: Config 47 requires: 48 - path: ./leeroy-app 49 - path: ./leeroy-web 50 ``` 51 52 Now, from the `multi-config-microservices` directory, again run: 53 54 ```bash 55 skaffold dev 56 ``` 57 58 The two applications should be built and deployed like before but in the same Skaffold session. If you want to go back to iterating on the applications individually you can simply pass in the `--module` or `-m` flag with the `metadata.name` value of the config that you want to activate. 59 60 ```bash 61 skaffold dev -m app-config 62 ```