DevOps Classroomnotes 17/Sep/2023

Kubernetes Contd

ConfigMaps and Secrets

  • Refer Here for official docs of config maps
  • They are used to store non credential information and make it available to Container in Pod as
    • Environmental Variable
    • Volume mounted to some folder
  • Secrets in kuberenetes are exactly the same but the differenc is values in secrets should be base64 encode Refer Here for official docs
  • Lets create a simple pod spec which mounts
    • username from config map
    • password from secret
  • Refer Here for the changeset and apply the specs and View the environmental variables
  • Refer Here for the changes with volumemounts for configu maps and secrets. Apply the changes to mount config map and secrets as volume

Kubernetes Volumes

  • Refer Here for official docs
  • Types of Volumes

    • Volumes: These are ephemeral
    • PersistentVolumes: Refer Here for Persistent Volume
  • Kubernetes Storage Classes Refer Here
  • For PVC, PVs and Storage classes refer class room recording
  • Apply the manifests
  • Refer Here for the changes to create a pvc on aks cluster
  • Insert some data
  • Delete the pod
  • Recreate the pod
  • Data should be present


Elastic Kubernetes Service

  • This is managed service from AWS
  • EKS is easily created from a tool called as eksctl
  • Install aws cli and configure authentication for aws iam user
  • Lets create a config file ekscluster.yaml
kind: ClusterConfig

  name: qteks-cluster
  region: us-east-1

  - name: ng-1
    instanceType: t2.large
    desiredCapacity: 2
  • Now create the cluster by executing eksctl create cluster -f ekscluster.yaml


Storage Class
  • Refer Here for manifests and try creating storage classs and use it in mysql-pod
  • Refer Here for creating table with some data in mysql
Setup application
  • Create a nginx-db pod with a persistent volume (deployment with 1 replica)
  • create a service nginx-svc with cluster ip
  • Create a nginx-app pod (deployment with 1 replica)
  • create a service nginx-app-svc with type LoadBalancer
  • Access the load Balancer and configure the application


Assigning Pods to Nodes

  • Refer Here
  • Pods selection nodes
  • nodes repelling pods: taints and tolerations

Stateful Set

  • Refer Here for official docs
  • Refer Here for running a stateful application
  • Apply the Stateful set
  • Now send a curl request to a pod by using <podname>.<svcname>

Leave a Reply

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

About continuous learner

devops & cloud enthusiastic learner