About Kubernetes
What is Kubernetes? : Management Containers
Kubernetes is a platform for managing containerized applications. It handles deploying, scaling, and automatically adjusting applications when issues arise. It's suitable for businesses ranging from large enterprises to fast-growing companies and operates efficiently in cloud environments.
Kubernetes roles
- Deploys and runs containers across multiple servers (nodes).
- Automatically horizontally scales the number of container replicas in response to changes in traffic or resource utilization. This ensures application availability and performance by dynamically adjusting the workload distribution across multiple containers.
- Automatically restarts containers that fail or replaces them with new ones.
- Manages network communication and load balancing between multiple containers.
- Safely manages application updates and rollbacks.
- Provides various features necessary for operating containerized applications, such as storage management and configuration management.
Kubernetes structure
- Control Plane: The set of core components that manage the Kubernetes cluster (e.g., API server, scheduler, controller manager, etc.).
- Node: A physical or virtual machine where the actual containers are executed.
- Pod: A group of one or more containers, which is the smallest deployable and manageable unit in Kubernetes.
- kubectl: A command-line tool for interacting with Kubernetes clusters.
Control Plane
- API Server: Provides the cluster's API to handle all management requests.
- etcd: A core storage that saves all of the cluster's data and state information.
- Controller Manager: Manages the controllers that maintain the cluster's state.
- Scheduler: Determines the best node to run Pods.
Node
- Kubelet
- Container Runtime
- Kube-proxy
What is Minikube?
Minikube is a tool that makes it easy to run a single-node Kubernetes cluster in your local environment.
It is primarily used for local development and learning purposes, and it provides a Kubernetes environment that doesn't rely on cloud provider libraries. You can start a cluster using the command minikube start.
What is kubectl?
kubectl is a command-line interface (CLI) tool for interacting with Kubernetes clusters.
It allows you to inspect the cluster's state, deploy applications, view logs, and perform other management operations. For example, you can find cluster information using the command kubectl get
Kubectl Commands
Display cluster information
kubectl cluster-info # Display cluster information
Create Or Update Namespace
kubectl apply -f {yaml file}
kubectl apply -f namespace.yaml
Display resources
kubectl get nodes
kubectl get namespaces
kubectl get pods
kubectl get pods -A # show all pods
kubectl get pods -f {file name | derectory} # show contain this conditions
kubectl get pods -n {namespace} -o wide # set namespace
kubectl get pods -o wide # show infomation contain ip information
kubectl describe pod {pod name} -n {the pod's namespace} # Detail informantion
Delete Pod
kubectl delete pod {pod name} -n {the pod's namespace}
Execute command in a container
kubectl exec -it {pod name} -- /bin/sh
‘--’ : it is used to separate the kubectl exec command options from the command that you want to execute inside the container
Display Pod’s log
kubectl logs {pod name} -n {the pod's namespace}