CloudWiki
Resource

ReplicaSet

Kubernetes
Kubernetes
A ReplicaSet maintains a stable set of replica Pods running at any given time. As such, it is often used to guarantee the availability of a specified number of identical Pods.
Terraform Name
terraform
kubernetes_deployment
ReplicaSet
attributes:
  • replicas - (Optional) The number of desired replicas. This attribute is a string to be able to distinguish between explicit zero and not specified. Defaults to 1.
    For more info see Kubernetes reference
Associating resources with a
ReplicaSet
Resources do not "belong" to a
ReplicaSet
Rather, one or more Security Groups are associated to a resource.
Create
ReplicaSet
via Terraform:
The following HCL creates a deployment with 3 replicas
Syntax:

resource "kubernetes_deployment" "example" {
 metadata {
   name = "terraform-example"
   labels = {
     test = "MyExampleApp"
   }
 }

 spec {
   replicas = 3

   selector {
     match_labels = {
       test = "MyExampleApp"
     }
   }

   template {
     metadata {
       labels = {
         test = "MyExampleApp"
       }
     }

     spec {
       container {
         image = "nginx:1.21.6"
         name  = "example"

         resources {
           limits = {
             cpu    = "0.5"
             memory = "512Mi"
           }
           requests = {
             cpu    = "250m"
             memory = "50Mi"
           }
         }

         liveness_probe {
           http_get {
             path = "/"
             port = 80

             http_header {
               name  = "X-Custom-Header"
               value = "Awesome"
             }
           }

           initial_delay_seconds = 3
           period_seconds        = 3
         }
       }
     }
   }
 }
}

Create
ReplicaSet
via CLI:
Parameters:

apiVersion: apps/v1
kind: ReplicaSet
metadata:
 name: my-replicaset
spec:
 replicas: 3
 selector:
   matchLabels:
     app: my-app
 template:
   metadata:
     labels:
       app: my-app
   spec:
     containers:
     - name: my-container
       image: my-image:latest
       ports:
       - containerPort: 80

Example:

kubectl apply -f https://kubernetes.io/examples/controllers/frontend.yaml

aws cost
Costs
Direct Cost
Indirect Cost
No items found.
Best Practices for
ReplicaSet

Categorized by Availability, Security & Compliance and Cost

Low
Access allowed from VPN
No items found.
Low
Auto Scaling Group not in use
No items found.
Medium
Connections towards DynamoDB should be via VPC endpoints
No items found.
Medium
Container in CrashLoopBackOff state
No items found.
Low
EC2 with GPU capabilities
No items found.
Medium
EC2 with high privileged policies
No items found.
Medium
ECS cluster delete alarm
No items found.
Critical
ECS task with Admin access (*:*)
Medium
ECS task with high privileged policies
No items found.
Critical
EKS cluster delete alarm
No items found.
Medium
ElastiCache cluster delete alarm
No items found.
Medium
Ensure Container liveness probe is configured
No items found.
Medium
Ensure ECS task definition has memory limit
No items found.
Critical
Ensure EMR cluster master nodes are not publicly accessible
No items found.
More from
Kubernetes