DevOps Classroomnotes 04/Dec/2022

Replication Controller

  • Replication Controller is the first gen replica workload for k8s objects.
  • Replication Controller labels can be matched only on equality not set based Refer Here

Replica Set

  • This is succesor to Replication Controller.
  • Replica Sets are used by Deployments.
  • Replica Sets changes can be tracked and that is what the deployment uses.
  • Refer Here for the official docs
  • Lets create a replicaset with 4 nginx Pods. Refer Here for the changes
    Preview
  • k8s replica set will always try to maintain the desired count. Of the desired is not matching with actual state, a new Pods can be created or existing pods can be deleted to maintain the desired state
  • Scaling number of replicas

    • imperative way:
      Preview
    • declartive way: Change the spec and apply the spec again.
      Preview
  • Exercise: Create a replica set with Pod specification with jenkins Pod and ping -c 4 google.com in alpine as init container with restart policy Never.
  • Refer Here for the changeset
    Preview
  • top commands using kubectl (Need to fix metrics server)
    • metrics server needs to be added to k8s cluster Refer Here
  • kubernetes UI: Refer Here (Need to work with tokens and proxy)
  • Terms to understand

    • addons
    • users
    • service account
    • cluster role binding
  • Next Steps

    • Limits to containers
    • Expose applications to outside world
    • Kubernetes as a service (AKS, EKS)
    • Deployments & Other workloads
    • deal with storage
    • Authentication and Authorizations
  • Getting inside Containers
kubectl exec -it <pod-name> -- <shell /bin/bash /bin/sh>
kubectl exec <pod-name> -- <linux command>

Kubernetes Service

  • Refer Here for official docs
  • Overview
    Preview
  • Lets use the replica set with 4 nginx replicas and create a cluster ip service which creates an internal ip accesssible within k8s cluster Refer Here
  • Create and verify replica set with pods
    Preview
    Preview
  • This svc can be verified only by some Pod in k8s cluster. Lets create an experiment pod. Refer Here for the changes
  • Check for accessing nginx svc using ip
    Preview
  • We are able to access the nginx using svc ip with in cluster
  • Now verify with service name inside cluster and it will be working
    Preview
  • K8s can expose the service to the external world
    • nodePort: Expose the service to the particular port on all the nodes of k8s cluster
    • loadBalancer: Exposes the service to the loadbalancer
    • external: Creates a DNS record which can be added to DNS servers maintaine by your org.
  • Expose the above service to the nodes. Refer Here for the changes
    Preview
  • Lets solve this error by changing node port Refer Here
    Preview

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
Animated Social Media Icons by Acurax Wordpress Development Company

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