DevOps Classroomnotes 01/Dec/2022

Kubeadm installation

  • To fix the error with cri-socket we have used the following command
kubeadm init --pod-network-cidr=10.244.0.0/16 --cri-socket=unix:///var/run/cri-dockerd.sock

Preview
* The commands informed by k8s cluster are

Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

Alternatively, if you are the root user, you can run:

  export KUBECONFIG=/etc/kubernetes/admin.conf

You should now deploy a pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  https://kubernetes.io/docs/concepts/cluster-administration/addons/

Then you can join any number of worker nodes by running the following on each as root:

kubeadm join 172.31.14.130:6443 --token zz7um7.dy22vb0xppw1jy05 \
        --discovery-token-ca-cert-hash sha256:486c786fa26ee4e54144955a48cc1631082a14555622ac2818dc32438a104198
  • Now for k8s networking the reference specification is CNI. There are many vendors who implement this. We are going to use flannel Refer Here for addons. For flannel Refer Here
    Preview
  • Now add the other node to k8s cluster using join command from above and also include –cri-socket
  • Now setting up kubectl Refer Here

Kubernetes Workloads

  • Pod:
    • This is smallest unit of creation in k8s cluster
    • Pods have container(s)
    • Each Pod in k8s cluster gets a unique ip address
    • All the containers in the Pod share the same network namespace.
      Preview
      Preview

Kubernetes api versioning

  • To k8s cluster we directly or indirectly using kubectl speak with API Server
  • k8s has lot of features underdevelopment, stable, improvements
  • There are 3 channels for objects/features
    • alpha
    • beta
    • stable
  • To fill apiVersion the syntax <api-group>/<version>
  • API Group is group of similar k8s objects
  • If the api group is Core then apiVersion: <version>

Kubernetes Objects

  • Every thing in k8s is an object.
  • To declare an object, we need to specify 4 fields
apiVersion: 
kind: 
metadata:
spec:
  • K8s cluster will create and object and add an extra field called as status
apiVersion: 
kind: 
metadata:
spec:
status:
  • kind is type of object
  • metadata describes some additional information about object you are trying to create (name, labels)
  • spec: This is the desired state
  • To get all the api-resources in your k8s cluster
kubectl api-resources

Leave a Reply

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

About continuous learner

devops & cloud enthusiastic learner