diff --git a/infra/eks/_providers.tf b/infra/eks/_providers.tf index 3ab28e2..ab17017 100644 --- a/infra/eks/_providers.tf +++ b/infra/eks/_providers.tf @@ -3,15 +3,15 @@ provider "aws" { # Optionally pick credentials/profile via CLI flags or ENV vars } -provider "kubernetes" { - host = module.eks.cluster_endpoint - cluster_ca_certificate = base64decode(module.eks.cluster_certificate_authority_data) - exec { - api_version = "client.authentication.k8s.io/v1beta1" - command = "aws" - args = ["eks", "get-token", "--cluster-name", module.eks.cluster_name] - } -} +# provider "kubernetes" { +# host = module.eks.cluster_endpoint +# cluster_ca_certificate = base64decode(module.eks.cluster_certificate_authority_data) +# exec { +# api_version = "client.authentication.k8s.io/v1beta1" +# command = "aws" +# args = ["eks", "get-token", "--cluster-name", module.eks.cluster_name] +# } +# } # resource "kubernetes_namespace" "node-app" { # metadata { name = "node-api" } diff --git a/infra/eks/_variables.tf b/infra/eks/_variables.tf index dca4979..ddbf0d9 100644 --- a/infra/eks/_variables.tf +++ b/infra/eks/_variables.tf @@ -24,7 +24,7 @@ variable "alb_public_subnet_ids" { variable "instance_type" { type = string - default = "t3.small" + default = "t3a.small" } # variable "desired_capacity" { diff --git a/infra/eks/cluster.tf b/infra/eks/cluster.tf index 2edea3d..5bfdfe7 100644 --- a/infra/eks/cluster.tf +++ b/infra/eks/cluster.tf @@ -3,14 +3,14 @@ module "eks" { version = "~> 20.0" cluster_name = "${var.environment}-eks" - cluster_version = "1.30" + cluster_version = "1.31" vpc_id = var.vpc_id subnet_ids = var.app_public_subnet_ids - cluster_endpoint_private_access = true - cluster_endpoint_public_access = true - cluster_endpoint_public_access_cidrs = ["119.15.74.49/32"] + cluster_endpoint_private_access = true + cluster_endpoint_public_access = true + # cluster_endpoint_public_access_cidrs = ["119.15.74.49/32"] enable_cluster_creator_admin_permissions = true diff --git a/k8s/deployment.yaml b/k8s/deployment.yaml index b729f8e..b29258d 100644 --- a/k8s/deployment.yaml +++ b/k8s/deployment.yaml @@ -4,29 +4,31 @@ metadata: name: demo-node-app spec: replicas: 1 - selector: - matchLabels: - app: demo-node-app - template: - metadata: + selector: # Selector is used to find which Pods are part of this Deployment. + matchLabels: # A simple key/value filter: any Pod whose labels include all listed pairs is part of the set. + app: demo-node-app # Needs to match the label in the pod template + template: # Template is used to create Pods. + metadata: # Metadata is used to set labels and annotations on the Pods. labels: app: demo-node-app - spec: - containers: - - name: demo-node-app + spec: # Spec is used to define the containers that will run in the Pods. + containers: # An array of container definitions. A Pod can run one or many containers that share the same network namespace and volumes. + - name: demo-node-app # A unique identifier within this Pod for the container. Used in logs, metrics, and when referencing the container in probes or kubectl exec -c demo-node-app image: nrampling/demo-node-app:1.0.3 ports: - containerPort: 3000 -# --- -# apiVersion: v1 -# kind: Service -# metadata: -# name: demo-node-app-svc -# spec: -# selector: -# app: demo-node-app -# ports: -# - protocol: TCP -# port: 3000 -# targetPort: 3000 -# type: NodePort +--- +apiVersion: v1 +kind: Service +metadata: + name: demo-node-app-svc + labels: + app: demo-node-app +spec: + type: ClusterIP + selector: + app: demo-node-app + ports: + - port: 3000 + targetPort: 3000 + protocol: TCP