Open topic with navigation

# Creating a Target Group for Controller Service Ports

Execute the following commands to obtain the new ingress service ports.

For the new frontend-ingress-controller-svc:

    kubectl get svc -n core | grep frontend-ingress-controller-svc

Example output:

    frontend-ingress-controller-svc LoadBalancer 172.20.150.202 <none> 3000:30058/TCP 18h

Where 30058 is the new ingress service node port for port 3000, and must be recorded.

For the new portal-ingress-controller-svc:

    kubectl get svc -n core | grep portal-ingress-controller-svc

Example output:

    portal-ingress-controller-svc NodePort 172.20.26.194 <none> 5443:31704/TCP,5444:32558/TCP 170m

Where 31704 is the new ingress service node port for port 5443, and must be recorded.

To create the target group for the port values for frontend-ingress-controller-svc and portal-ingress-controller-svc using the web UI:
This process must be performed twice, once for frontend-ingress-controller-svc and once for portal-ingress-controller-svc.

1. Using the Find Services search tool, locate and browse to the EC2 dashboard.
2. In the left navigation panel, under Load Balancing, click Target Groups.
3. On the Target Groups management page, click Create target group.

1. On the Specify group details page, enter values for the following:
   1. Under Choose a target type, select Instances.
   2. Target group name: Choose a descriptive name for easier identification; for example, srgdemo-5443-tg
   3. Protocol: change to HTTPS
   4. Port:the port value for frontend-ingress-controller-svc or portal-ingress-controller-svc, which you recorded above in Creating a Target Group for Controller Service Ports
   5. VPC: select your VPC
   6. Tags: Optionally, add descriptive tags as desired.

1. Click Next.
2. On the Register Targets page, set values for the following:
   1. Available instances: Select your worker node instances only.
   2. Ports for the selected instances: For the selected instances, use the port value for frontend-ingress-controller-svc or portal-ingress-controller-svc, which you recorded above in Creating a Target Group for Controller Service Ports.

1. Click Include as pending below. All marked instances will be added to the list of pending instances.

1. Click Create target group.
2. You will be redirected back to the target group management page. From the list, select the newly created target group. From the bottom of the page, record its ARN in the AWS worksheet.

To create the target group for the port values for frontend-ingress-controller-svc and portal-ingress-controller-svc using the CLI:

1. Run the following command:
   `# aws elbv2 create-target-group \
   --name` `<port values for frontend-ingress-controller-svc and portal-ingress-controller-svc> \
   --protocol HTTPS \
   --port` `<port values for frontend-ingress-controller-svc and portal-ingress-controller-svc> \
   --vpc-id <VPC ID> \
   --health-check-protocol HTTPS \
   --target-type instance`

Parameters:

< port values for frontend-ingress-controller-svc and portal-ingress-controller-svc> : Choose some descriptive name, such as `srgdemo-<PORT_NUMBER>-tg` and record the value in the AWS worksheet.

<VPC ID>: The ID of your VPC as recorded in your AWS worksheet.

Example input and output:

    # aws elbv2 create-target-group \
    --name srgdemo-5443-tg \
    --protocol HTTPS \
    --port 5443 \
    --vpc-id vpc-0143197ca9bd9c117 \
    --health-check-protocol HTTPS \
    --target-type instance

    {
       "TargetGroups":[
          {
             "TargetGroupArn":"arn:aws:elasticloadbalancing:eu-central-\1:115370848038:targetgroup/srgdemo-3000-tg/c0684be94405b6b7",
             "TargetGroupName":"srgdemo-5443-tg",
             "Protocol":"HTTPS",
             "Port":5443,
             "VpcId":"vpc-0143197ca9bd9c117",
             "HealthCheckProtocol":"HTTPS",
             "HealthCheckPort":"traffic-port",
             "HealthCheckEnabled":true,
             "HealthCheckIntervalSeconds":30,
             "HealthCheckTimeoutSeconds":5,
             "HealthyThresholdCount":5,
             "UnhealthyThresholdCount":2,
             "HealthCheckPath":"/",
             "Matcher":{
                "HttpCode":"200"
             },
             "TargetType":"instance"
          }
       ]
    }

1. From the output, record the value of `TargetGroupArn` in your AWS worksheet.

## Tagging the Target Group (CLI)

Optionally, you can tag the target group for easier identification.

To tag the target group using the CLI:

1. Run the following command:
   `# aws elbv2 add-tags \
   --resource-arns <Target group values for frontend-ingress-controller-svc and portal-ingress-controller-svc ARN> \
   --tags Key=owner,Value=<owner>`

    # aws elbv2 add-tags \
    --resource-arns arn:aws:elasticloadbalancing:eu-central-1:115370848038:targetgroup/srgdemo-5443-tg/c0684be94405b6b7 \
    --tags Key=owner,Value=srgdemo

Next Step: Adding Targets to the Target Group for Controller Services