Skip to content

An intro to Kubernetes concepts by Cloud Native Bootcamps at CORE

Notifications You must be signed in to change notification settings

core-school/kubernetes-kind-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kubernetes intro

🍊 k8s means kubernetes. Why? There are 8 letters from k to s

Key concepts (extracted from k8s docs):

  • Pods Pods are the smallest deployable units of computing that you can create and manage in Kubernetes. A 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. A Pod's contents are always co-located and co-scheduled, and run in a shared context. A Pod models an application-specific "logical host": it contains one or more application containers which are relatively tightly coupled. In non-cloud contexts, applications executed on the same physical or virtual machine are analogous to cloud applications executed on the same logical host.

  • Services An abstract way to expose an application running on a set of Pods as a network service. With Kubernetes you don't need to modify your application to use an unfamiliar service discovery mechanism. Kubernetes gives Pods their own IP addresses and a single DNS name for a set of Pods, and can load-balance across them.

  • Deployments A Deployment provides declarative updates for Pods and ReplicaSets. You describe a desired state in a Deployment, and the Deployment Controller changes the actual state to the desired state at a controlled rate. You can define Deployments to create new ReplicaSets, or to remove existing Deployments and adopt all their resources with new Deployments.

Create a kubernetes cluster with kind

kind create cluster
Creating cluster "kind" ...
 ✓ Ensuring node image (kindest/node:v1.20.2) 🖼
 ✓ Preparing nodes 📦
 ✓ Writing configuration 📜
 ✓ Starting control-plane 🕹️
 ✓ Installing CNI 🔌
 ✓ Installing StorageClass 💾
Set kubectl context to "kind-kind"
You can now use your cluster with:

kubectl cluster-info --context kind-kind

Some commands to know

  • kubectl get <resource>

  • kubectl cluster-info

  • kubectl proxy

  • Upload image to kind cluster: kind load docker-image <image_name>

  • Apply/Create a resource in the cluster from a file: kubectl apply -f

Access kubernetes dashboard

  1. First run kubectl proxy and access dashboard: [http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/#/login]
  2. Create a sample user and a token to enter the cluster dashboard: https://github.com/kubernetes/dashboard/blob/master/docs/user/access-control/creating-sample-user.md

Access a deployed service

See [https://kubernetes.io/docs/tasks/administer-cluster/access-cluster-services/#manually-constructing-apiserver-proxy-urls]

curl http://localhost:8001/api/v1/namespaces/default/services/service-core-code-school:http/proxy/

Roll update

kubectl set image deployments/core-deployment core-app-container=demo:latest

References

Managed cluster providers