Kubernetes basics - ConfigMap

Intro : overried ENTRYPOINT of a DOcker image in k8s We can overried ENTRYPOINT value in a Docker image with command argumanet. CMD can’t be overwrrided by command argument. We have to use args argument instead. https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/ Here is an official sample. pods/commands.yaml apiVersion: v1 kind: Pod metadata: name: command-demo labels: purpose: demonstrate-command spec: containers: - name: command-demo-container image: debian command: ["printenv"] args: ["HOSTNAME", "KUBERNETES_PORT"] restartPolicy: OnFailure Inject environment variable In container section, add env.

Kubernetes basics - Deployment

ReplicationController No more details than official document. https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller/ It enables HA, auto scaling, multi node controll (across nodes). This is the first fancy function in k8s!! ReplicaSet ReplicaSet is kind of newer version of ReplicationController. https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller/#replicaset In stead of ReplicationController and ReplicaSet, we create “Deployment” object to manage Pods. Actually, Deployment use ReplicaSet and when we create a Deployment it creates ReplicaSet automatically. Labels and Selectors By labels, Selectors can select the Pod which should be monitored by the Selector.

Kubernetes basics - Namespace

Namespace As I worte before, namespace is kind of logical boundary. Normaly, objects in namesapce A can’t communicate with objects in namespace B. So far, all objects are deployed in namespace default. We tagged name to a objects, and in the same namespaces object can be refered by its name label. Create a namespace kubectl create namespace dev # change namespace permanently kubectl config set-context $(kubectl config current-context) --namespace=dev # My note kubectl config current-context #microk8s Or we can define namespace in YAML file also.

Kubernetes basics - Pod

Environment Please refer to the set up memo . I suppose you are already familiar to Docker image. K8s basic concepts In k8s environment, there are a few concepts we should know before starting. “INTRODUCTION TO KUBERNETES” from AWS is a conprehensive article. note. Architecture: https://eksworkshop.com/010_introduction/architecture/architecture_control_and_data_overview/ K8s objects While creating your own k8s environment, you create and delete a lot of types of objects, such as, Pod ReplicaSet Deployment Service Namespace and so on.

Set up Kubernetes in Ubuntu (single host cluster)

Pre-requirement of this post Host OS: Ubuntu18.04 snapd is install (for snapcraft.) Kubernetes is abbreviated as k8s. For single host k8s environment, there is a good k8s implementation called microk8s. I’ll use it. Setup on Ubuntu Install Docker and microk8s Install softwares, Docker and microk8s. sudo snap install docker sudo snap install microk8s --classic --channel=1.18/stable Granting permission sudo usermod -a -G microk8s $USER sudo chown -f -R $USER ~/.kube After re-login, check the k8s status.