Create a Microservices-based App

    This tutorial demonstrates how to create a microservices-based app Bookinfo, which is composed of four Services, and set a customized domain name to access the app.

    • You need to create a workspace, a project, and a user account () for this tutorial. The account needs to be invited to the project with the operator role. For more information, see Create Workspaces, Projects, Accounts and Roles.
    • project-admin needs to so that project-regular can define a domain name when creating the app.
    1. Log in to the web console of KubeSphere and navigate to Applications in Application Workloads of your project. In the Composing App tab, click Create Composing Application.

    2. On the Components page, you need to create microservices that compose the app. Click Add Service and select Stateless Service.

    3. Set a name for the Service (e.g productpage) and click Next.

      product-page

      Note

      You can create a Service on the dashboard directly or enable Edit Mode in the top right corner to edit the YAML file.

    4. Click Add Container Image under Container Image and input in the search bar to use the Docker Hub image.

      You must press Enter in your keyboard after you input the image name.

    5. Click Use Default Ports. For more information about image settings, see Container Image Settings. Click in the bottom right corner and Next to continue.

    6. On the Mount Volumes page, or click Next to continue.

    7. Click Add on the Advanced Settings page directly.

    8. When you finish adding microservices, click Next.

      microservices-done

    9. On the Internet Access page, click Add Route Rule. In the Specify Domain tab, set a domain name for your app (e.g. demo.bookinfo) and select http in the Protocol field. For Paths, select the Service productpage and port 9080. Click OK to continue.

      Note

      The button Add Route Rule is not visible if the project gateway is not set.

    10. Wait for your app to reach the Ready status.

      status-active

    1. As you set a domain name for the app, you need to add an entry in the hosts () file. For example, add the IP address and hostname as below:

      Note

      You must add your own IP address and hostname.

    2. In Composing App, click the app you just created.