Completek8s Classroom notes 07/Oct/2023

EKS

  • EKS is a managed service and is integrated with AWS Ecosystem
  • Pods get vpc network addresses
  • Allowing IAM users or groups to acess kubernetes
  • control plane and data plane logs and metrics can be sent to AWS Cloud Watch
  • EKS pricing models

    • Fixed Control plane costs (0.1$ per hour)
    • Variable costs (Worker nodes):
      • EC2
      • Fargate
  • EKS-Distro: Refer Here for offical docs.
  • EKS anywhere: Refer Here
  • EKS Outposts: Hybrid connectivity
  • EKS Steup options

    • Manual:
      • AWS Console
      • AWS CLI
    • Declartive:
      • Terraform
      • Cloudformation
    • Abstractions:
      • EKSCTL

Creating EKS From AWS Console

  • Refer Here for create eks cluster
  • Create a EKS admin policy
  • Create an EKS cluster admin group and assing the EKS admin policy to the group
  • Create a new user and add the user to EKS Cluster Admin Group
  • Create a new Credentials and Add them to your AWS CLI Configuration
  • EKS Admin policy
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "Statement1",
            "Effect": "Allow",
            "Action": "ec2:*",
            "Resource": "*"
        },
        {
            "Effect": "Allow",
            "Action": "eks:*",
            "Resource": "*"
        },
        {
            "Effect": "Allow",
            "Action": "kms:*",
            "Resource": "*"
        },
        {
            "Effect": "Allow",
            "Action": "iam:*",
            "Resource": "*"
        }

    ]
}

Preview
* Create EKS Admin group
Preview
* Now create a user called as qtadmin and assign the user to the group EKS-Admins
* Now add a node group
* Configure AWS CLI with the qt admin user access key and secret key
* Now update kubeconfig by executing command

aws eks update-kubeconfig --region us-west-2 --name myekscluster
  • Now create some resources using the following yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: azure-vote-back
spec:
  replicas: 1
  selector:
    matchLabels:
      app: azure-vote-back
  template:
    metadata:
      labels:
        app: azure-vote-back
    spec:
      nodeSelector:
        "kubernetes.io/os": linux
      containers:
      - name: azure-vote-back
        image: mcr.microsoft.com/oss/bitnami/redis:6.0.8
        env:
        - name: ALLOW_EMPTY_PASSWORD
          value: "yes"
        resources:
          requests:
            cpu: 100m
            memory: 128Mi
          limits:
            cpu: 250m
            memory: 256Mi
        ports:
        - containerPort: 6379
          name: redis
---
apiVersion: v1
kind: Service
metadata:
  name: azure-vote-back
spec:
  ports:
  - port: 6379
  selector:
    app: azure-vote-back
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: azure-vote-front
spec:
  replicas: 1
  selector:
    matchLabels:
      app: azure-vote-front
  template:
    metadata:
      labels:
        app: azure-vote-front
    spec:
      nodeSelector:
        "kubernetes.io/os": linux
      containers:
      - name: azure-vote-front
        image: mcr.microsoft.com/azuredocs/azure-vote-front:v1
        resources:
          requests:
            cpu: 100m
            memory: 128Mi
          limits:
            cpu: 250m
            memory: 256Mi
        ports:
        - containerPort: 80
        env:
        - name: REDIS
          value: "azure-vote-back"
      - name: stress
        image: alpine
        resources:
          requests:
            cpu: 100m
            memory: 128Mi
        command:
          - sleep
          - 1d
---
apiVersion: v1
kind: Service
metadata:
  name: azure-vote-front
spec:
  type: LoadBalancer
  ports:
  - port: 80
  selector:
    app: azure-vote-front
  • Make necessary changes in the Service to create Network loadbalancer

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About continuous learner

devops & cloud enthusiastic learner