k8s

26 阅读1分钟

Kubernetes (often abbreviated as "k8s") is an open-source system for automating deployment, scaling, and management of containerized applications. It was originally designed by Google and is now maintained by the Cloud Native Computing Foundation.

In Kubernetes, applications are described as a set of containers and their interactions, and Kubernetes takes care of scheduling containers to run on nodes, ensuring that there's the desired number of container instances running at any given time, and that resource limits aren't exceeded.

Here are some key concepts in Kubernetes:

  1. Pods: The smallest deployable units of computing that can be created and managed in Kubernetes. A pod represents a single instance of a running process in your cluster.

  2. Services: An abstract way to define a logical set of Pods and a policy by which to access them. Services provide stable networking and DNS regardless of any changes to the underlying pods.

  3. Deployments: A higher-level concept that manages ReplicaSets and provides declarative updates for Pods and ReplicaSets.

  4. ReplicaSets: Ensure that a stable number of pod replicas are running at any given time.

  5. Namespaces: Virtual clusters that allow you to divide cluster resources between multiple users.

Some basic kubectl commands you might find useful:

  • kubectl get pods: List all pods in the current namespace.
  • kubectl describe pod <pod_name>: Show details of a pod.
  • kubectl apply -f <filename>.yaml: Apply a configuration to one or more resources.
  • kubectl delete -f <filename>.yaml: Delete a resource using a YAML file.
  • kubectl logs <pod_name>: Print the logs for a container in a pod.
  • kubectl exec <pod_name> -- <command>: Run a command in a container in a pod.