Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions infra/eks/_providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion infra/eks/_variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ variable "alb_public_subnet_ids" {

variable "instance_type" {
type = string
default = "t3.small"
default = "t3a.small"
}

# variable "desired_capacity" {
Expand Down
8 changes: 4 additions & 4 deletions infra/eks/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
44 changes: 23 additions & 21 deletions k8s/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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