DevOps Classroomnotes 06/May/2023

Agenda

  • Day 1: (6th May)
    • Topics:
      • Namespace
      • Config Maps and Secrets
      • RBAC
    • Scenarios:
  • Day 2: (7th May)
    • Topics:
      • Ingress
      • AKS
      • EKS
    • Scenarios
  • Day 3: (13th May)
    • Topic:
      • Kustomize
    • GitOps
      • Create k8s cluster from terraform
      • when code committed
        • build image
        • push to registry
        • deploy into k8s cluster
        • Security Scans:
          • Images
          • K8s
      • From Github Actions

Namespace

  • Namespace is logical/virtual cluster within k8s cluster
  • K8s resources will be of two categories by scope
    • Namespace resources: They belong to a namespace.
      Preview
    • Cluster resources: They belong to a cluster
      Preview
  • Creating namespace: kubctl create ns <name>

Config Map

  • Refer Here for official docs
  • Lets create a dummy config map. Refer Here for the changes
  • Create the config map
    Preview
  • Lets configure a pod to use this config map. Refer Here
  • There are four different ways that you can use a ConfigMap to configure a container inside a Pod:
    • Inside a container command and args
    • Environment variables for a container
    • Add a file in read-only volume, for the application to read
    • Write code to run inside the Pod that uses the Kubernetes API to read a ConfigMap
  • Load config map data as Environment variables. Refer Here for pod spec which loads the config map as environmental variables
    Preview
  • Experiments:

    • change the config map add one more key and
      • cross check with existing pod for new values. Environmental variables are not updated
        Preview
        Preview
  • Activity: Create a mysql config map with values for username, password and root password. Use that in mysql-pod/rs/statefulset. Refer Here for the changes
    Preview
  • Refer Here for using config maps as files from pod
    Preview
    Preview
  • To deal with confidential data k8s has secrets

Secrets

  • Refer Here for k8s secrets
  • Secrets can be created from kubectl Refer Here and manifest files Refer Here
  • Create a secret and describe secret
    Preview
  • use the secret in Pod as environment variable
    Preview
  • Refer Here for the changes done to use secrets

Exercise

  • Create a private registry (acr or ecr)
  • Google to findout how to configure all nodes in k8s cluster to use your private registry
    • Create a secret based on registry credentials
    • container image details in manifest will have extra field about the above created secret.
  • Create a dockerfile
FROM alpine
label author=khaja
  • We have create a replica set with image from private registry. Pod status is pending as image is not found
    Preview
  • Traditional approach: Refer Here

RBAC

  • Authorization in K8s Refer Here
    Preview
  • Authentication in k8s Refer Here
    Preview
  • Attaching Authorization to identity using Bindings
    • RoleBinding
    • ClusterRoleBinding
  • Refer Here for creating users and setting permissions

Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a Reply

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

Please turn AdBlock off
Floating Social Media Icons by Acurax Wordpress Designers

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube