Exercise

1 minute read

In this exercise, you’ll add Services to the VotingApp

  1. In the votingapp directory, create YAML files containing the specifications for the Services of each microservice in the application, according to the table below:

    MicroserviceFile NameService TypeService Details
    Vote UIsvc-voteui.yamlNodePort (31000)nodePort 31000, port: 80, targetPort: 80
    Votesvc-vote.yamlClusterIPport: 5000, targetPort: 5000
    Redissvc-redis.yamlClusterIPport: 6379, targetPort: 6379
    Postgressvc-db.yamlClusterIPport: 5432, targetPort: 5432
    Resultsvc-result.yamlClusterIPport: 5000, targetPort: 5000
    Result UIsvc-resultui.yamlNodePort (31001)nodePort 31001, port: 80, targetPort: 80

    Note that it is not necessary to expose the worker Pod with a Service as no Pod needs to connect to it. Instead, it is the worker Pod that connects to redis and db.

    For each Pod/Service pair, make sure to properly define a label in the Pod and the corresponding selector in the Service.

  2. Deploy the application defined by these specifications

  3. Access the vote and result interfaces via the NodePort Services

  4. Delete the application