Skip to content

Commit

Permalink
fix: Make sure NLBs are provisioned
Browse files Browse the repository at this point in the history
  • Loading branch information
niallthomson committed Oct 1, 2024
1 parent 1d4e704 commit 4f2f467
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,16 @@ data "aws_vpc" "this" {
}

resource "kubernetes_manifest" "ui_nlb" {
depends_on = [module.eks_blueprints_addons]

manifest = {
"apiVersion" = "v1"
"kind" = "Service"
"metadata" = {
"name" = "ui-nlb"
"namespace" = "ui"
"annotations" = {
"service.beta.kubernetes.io/aws-load-balancer-type" = "external "
"service.beta.kubernetes.io/aws-load-balancer-type" = "external"
"service.beta.kubernetes.io/aws-load-balancer-scheme" = "internet-facing"
"service.beta.kubernetes.io/aws-load-balancer-nlb-target-type" = "instance"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@ resource "time_sleep" "wait" {
}

resource "kubernetes_manifest" "ui_nlb" {
depends_on = [module.eks_blueprints_addons]

manifest = {
"apiVersion" = "v1"
"kind" = "Service"
"metadata" = {
"name" = "ui-nlb"
"namespace" = "ui"
"annotations" = {
"service.beta.kubernetes.io/aws-load-balancer-type" = "external "
"service.beta.kubernetes.io/aws-load-balancer-type" = "external"
"service.beta.kubernetes.io/aws-load-balancer-scheme" = "internet-facing"
"service.beta.kubernetes.io/aws-load-balancer-nlb-target-type" = "instance"
}
Expand Down
4 changes: 3 additions & 1 deletion manifests/modules/security/irsa/.workshop/terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@ resource "time_sleep" "wait" {
}

resource "kubernetes_manifest" "ui_nlb" {
depends_on = [module.eks_blueprints_addons]

manifest = {
"apiVersion" = "v1"
"kind" = "Service"
"metadata" = {
"name" = "ui-nlb"
"namespace" = "ui"
"annotations" = {
"service.beta.kubernetes.io/aws-load-balancer-type" = "external "
"service.beta.kubernetes.io/aws-load-balancer-type" = "external"
"service.beta.kubernetes.io/aws-load-balancer-scheme" = "internet-facing"
"service.beta.kubernetes.io/aws-load-balancer-nlb-target-type" = "instance"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ sidebar_position: 35
Now, with the `carts` Service Account associated with the authorized IAM role, the `carts` Pod has permission to access the DynamoDB table. Access the web store again and navigate to the shopping cart.

```bash
$ kubectl -n ui get service ui-nlb -o jsonpath='{.status.loadBalancer.ingress[*].hostname}{"\n"}'
k8s-ui-uinlb-647e781087-6717c5049aa96bd9.elb.us-west-2.amazonaws.com
$ LB_HOSTNAME=$(kubectl -n ui get service ui-nlb -o jsonpath='{.status.loadBalancer.ingress[*].hostname}{"\n"}')
$ echo "http://$LB_HOSTNAME"
http://k8s-ui-uinlb-647e781087-6717c5049aa96bd9.elb.us-west-2.amazonaws.com
```

The `carts` Pod is able to reach the DynamoDB service and the shopping cart is now accessible!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ sidebar_position: 25
Now, with the `carts` Service Account annotated with the authorized IAM role, the `carts` Pod has permission to access the DynamoDB table. Access the web store again and navigate to the shopping cart.

```bash
$ kubectl get service -n ui ui-nlb -o jsonpath="{.status.loadBalancer.ingress[*].hostname}"
k8s-ui-uinlb-647e781087-6717c5049aa96bd9.elb.us-west-2.amazonaws.com
$ LB_HOSTNAME=$(kubectl -n ui get service ui-nlb -o jsonpath='{.status.loadBalancer.ingress[*].hostname}{"\n"}')
$ echo "http://$LB_HOSTNAME"
http://k8s-ui-uinlb-647e781087-6717c5049aa96bd9.elb.us-west-2.amazonaws.com
```

The `carts` Pod is able to reach the DynamoDB service and the shopping cart is now accessible!
Expand Down

0 comments on commit 4f2f467

Please sign in to comment.