CheatSheet | k8s


Introduction

  • Kubernetes (k8s) : is an open-source system for automating deployment, scaling, and management of containerized applications

    • Simply a container orchestration tool like docker swarm
  • Kubernetes Components:

    • Kubernetes Cluster : set of worker machines (nodes)

    • Nodes : host the Pods that are the components of the application workload

    • Pod : the smallest deployable units

  • Contents

    • Pod

    • Service

    • kubectl



1. Pod

  • Pods : are the smallest deployable units of computing that you can create and manage in Kubernetes.

    • Pod (as in a pod of whales or pea pod) is a group of one or more containers, with shared storage and network resources, and a specification for how to run the containers

    • Details : Pods | Kubernetes

# simple-pod.yaml
apiVersion: v1
kind: Pod
metadata:
  name: nginx
spec:
  containers:
  - name: nginx
    image: nginx:1.14.2
    ports:
    - containerPort: 80
# submit pod
kubectl apply -f https://k8s.io/examples/pods/simple-pod.yaml
# show pods
kubectl get pod
kubectl describe pod <pod_name>
kubectl logs <pod_name>
kubectl exec -it <pod_name> bash


2. Service

  • Introduction :

    •  Service is a method for exposing a network application that is running as one or more Pods in your cluster

      • Internal IP addresses of Pods keep changing each time they are created.

      • Services in k8s allow applications in these Pods to communicate with the outside world.

  • Type of Services

    • ClusterIP

    • NodePort

    • LoadBalancer

    • ExternalName

  • Details : Service | Kubernetes



3. Resource Quotas

  • Resouce Quota :, defined by a ResourceQuota object, provides constraints that limit aggregate resource consumption per namespace.
    • It can limit the quantity of objects that can be created in a namespace by type, as well as the total amount of compute resources that may be consumed by resources in that namespace.
  • Details : Resource Quotas | Kubernetes
kubectl get quota


Appendix.

  • kubectl : The Kubernetes command-line tool
kubectl describe limitrange

# kservc
kubectl get isvc
kubectl describe isvc