Kubernetes :9

DevOps Classroom Series – 11/Apr/2021

Config Maps & Secrets

  • A ConfigMap allows us to define application related data.
  • ConfigMap can be create through a literal value or from a file Preview
  • Lets create a config map from literal values and mount it to the pod Preview Preview
  • Now lets create a pod which mounts the config map Refer Here for the changes and create the pod
  • Config maps can be mounted to the pods as volumes as well Refer Here Preview
  • Secret is also much like config map but in secrets the values are base64 encoded
  • Kubernetes secretes has 3 available commands
    • generic: generic secret holds any key value pair
    • tls: secret for holding private-public key for communicating with TLS protocol
    • docker-registry: This is special kind of secret that stores usernames and passwords to connect to private registries
  • Create a secret Preview Preview
  • Like configmap secrets also can be mounted as a volume

Kuberenets as a Service on Cloud Platforms

  • Cloud providers like AWS, Azure , Google offer kubernetes as a service
  • When we use these offerings
    • Google Kuberenetes Engine
    • Azure Kubernetes Services
    • AWS Elastic Kubernetes Services
  • The cloud provider will manage
    • the k8s master nodes
    • the networking configuration
    • Load balancing and ingress capabilities
    • Persistent Volume native support to the clouds block and file storage
    • Integrated logging and monitoring support

break till 7:25 PM

Google Kubernetes Engine (GKE)

  • GKE is fully managed k8s cluster offered by GCP Preview Preview
  • Lets create a k8s cluster Refer Here and also navigate to the other sections
  • Create a 3 node cluster
gcloud container clusters create gke-cluster --num-nodes=1 --region=us-central1


Preview
Preview
Preview
  • Now to configure the kubectl execute the get-credentials Refer Here Preview
  • Now lets try to use the deployents and services created Refer Here Preview Preview
  • Lets wait till load balancer get the external ip and access the application using the load balancer external ip Preview Preview
  • k8s has create a loadbalancer in gcp Preview
  • Now lets try to apply the web deployment Preview
  • Lets try to create ingress loadbalancing using the examples Refer Here Preview
  • For gcp lets apply the annotation as specified
  • Now lets try to create the persitent volume dynamically and use it for postgres volume Refer Here
  • Preview
  • To be shared
    • manifest with correct annotations to run the ingress controller
    • manifest to use postgres with gke persistent volumes
  • Refer Here for the pvc sample
  • note: Refer Here to understand the flow of the application creating the docker file and running it on k8s cluster.

Next Weekend topics

  • AKS
  • EKS
  • HELM CHARTS
  • ISTIO
  • Openshift