mirror of
https://github.com/foo-dogsquared/wiki.git
synced 2025-01-31 04:58:21 +00:00
Update notes on SUSE cloud native fundamentals
This commit is contained in:
parent
3e5d089707
commit
f65ea66b28
63
structured/cli.kubectl.org
Normal file
63
structured/cli.kubectl.org
Normal file
@ -0,0 +1,63 @@
|
||||
:PROPERTIES:
|
||||
:ID: 49867854-3780-45ed-a703-4f5d22a92d39
|
||||
:END:
|
||||
#+title: kubectl
|
||||
#+date: "2021-06-13 00:29:49 +08:00"
|
||||
#+date_modified: "2021-06-14 22:48:57 +08:00"
|
||||
#+language: en
|
||||
#+property: header-arg :eval no
|
||||
|
||||
|
||||
The main binary when managing [[id:9e4f04d4-00a3-4898-ac98-924957fa868b][Kubernetes]] clusters.
|
||||
|
||||
|
||||
|
||||
|
||||
* Subcommands
|
||||
|
||||
- =api-resource= lists all of the resources it currently supports.
|
||||
- =cluster-info= prints information of the cluster and the add-ons installed.
|
||||
- =create [RESOURCE] [NAME]= creates the specified resource with the given name.
|
||||
- =describe [RESOURCE] [NAME]= prints a detailed description of the given resource.
|
||||
- =logs [RESOURCE] [NAME]= shows the log printed from the given resource.
|
||||
- =explain [RESOURCE]= prints an explaination of the given resource — e.g., ~kubectl explain pods~, ~kubectl explain rs~.
|
||||
- =get [RESOURCE]= list the specified resource from the cluster.
|
||||
+ =-o, --output [yaml|json|wide]= prints in the specified format.
|
||||
You can also print [[https://kubernetes.io/docs/reference/kubectl/overview/#custom-columns][the columns]] you only need.
|
||||
- =apply= applies a manifest, that is, a configuration file.
|
||||
|
||||
|
||||
** Resource names
|
||||
|
||||
Most of the subcommands require a resource type and a name.
|
||||
You can also refer to a specific resource with =${RESOURCE}/${NAME}= — e.g., =namespace/demo=, =deploy/hello=.
|
||||
|
||||
In the command line, you can refer to it like the following.
|
||||
|
||||
- ~kubectl create ns/demo~
|
||||
- ~kubectl describe deploy/hello~
|
||||
- ~kubectl create pod/python-app --namespace=demo~
|
||||
|
||||
|
||||
|
||||
|
||||
* Examples
|
||||
|
||||
As this is a massive tool, this needs massive examples.
|
||||
|
||||
|
||||
** Basic workflow example from a beginner's perspective
|
||||
|
||||
Say you want to deploy your application with Kubernetes akin to Docker with a single container.
|
||||
|
||||
# TODO: Improve this example, please.
|
||||
#+begin_src bash
|
||||
# Get the description of the cluster.
|
||||
kubectl cluster-info
|
||||
|
||||
# List all of the supported resources.
|
||||
kubectl api-resources
|
||||
|
||||
# Create a deployment.
|
||||
kubectl create deployment/hello-world --image=alpine
|
||||
#+end_src
|
@ -3,7 +3,7 @@
|
||||
:END:
|
||||
#+title: SUSE Cloud native fundamentals scholarship program
|
||||
#+date: "2021-06-07 18:21:19 +08:00"
|
||||
#+date_modified: "2021-06-10 19:38:02 +08:00"
|
||||
#+date_modified: "2021-06-13 15:59:44 +08:00"
|
||||
#+language: en
|
||||
|
||||
|
||||
@ -81,3 +81,13 @@ Best practices for application deployment:
|
||||
|
||||
- among the list of orchestrators, we have Docker Swarm, Apache Mesos, and Kubernetes among others;
|
||||
but for this topic, we'll go with Kubernetes as it is popular and also goes with the building blocks structure (a set of primitive blocks that can be customized to create more complex operations)
|
||||
|
||||
- Kubernetes manages several resources:
|
||||
+ it manages a cluster, the entire group of nodes where each node (service or master)
|
||||
+ worker nodes is a group of pods
|
||||
+ pods are a group of containers
|
||||
+ deployments indicate the state of the pod
|
||||
+ replica sets ensure at least one similar pod is running at a time
|
||||
+ services
|
||||
+ ConfigMaps handles pod configurations
|
||||
+ namespaces provide separation of logic between different applications, that is, application context
|
||||
|
40
structured/tools.kubernetes.org
Normal file
40
structured/tools.kubernetes.org
Normal file
@ -0,0 +1,40 @@
|
||||
:PROPERTIES:
|
||||
:ID: 9e4f04d4-00a3-4898-ac98-924957fa868b
|
||||
:END:
|
||||
#+title: Kubernetes
|
||||
#+date: "2021-06-13 14:37:01 +08:00"
|
||||
#+date_modified: "2021-06-14 22:42:48 +08:00"
|
||||
#+language: en
|
||||
|
||||
|
||||
Kubernetes is a container orchestrator letting you manage hundreds of containers at a time.
|
||||
While managing multiple containers with engines such as Docker and Podman, it is not really feasible if you want hundreds of them.
|
||||
|
||||
Kubernetes is composed of multiple components and can be intermingled with other related tools.
|
||||
For this, pre-bundled solutions (also known as distributions) such as [[http://k3s.io/][K3s]] exists with some related tools embedded to make installation easier.
|
||||
|
||||
Most installations feature the [[id:49867854-3780-45ed-a703-4f5d22a92d39][kubectl]] that controls the Kubernetes cluster.
|
||||
This is the program that you'll most likely going to pay attention to.
|
||||
|
||||
- composed of multiple smaller components:
|
||||
+ kubelet runs on all nodes, managing nodes — i.e., notifying the API server where the nodes belongs to
|
||||
+ kubeconfig is the term for a Kubernetes cluster configuration;
|
||||
mainly written in YAML file
|
||||
- Kubernetes uses the building blocks structure (or resources) that composes of simple blocks that can be combined to create complex operations
|
||||
- it also has extensibility mainly through exposing the API and letting you create custom resource definitions to fully extend Kubernetes with your app
|
||||
- Kubernetes manages the cluster along with some resources
|
||||
+ *the nodes which contain multiple pods*
|
||||
- nodes are categorized either as a master or a worker node
|
||||
- a master node is where the control plane is located
|
||||
- a worker node is where the data plane is located
|
||||
+ *pods which is a collection of containers*;
|
||||
usually, they are managed indirectly with deployments or resource sets;
|
||||
while pods can run multiple containers, it often contains one container as a recommended practice
|
||||
+ *deployments create the specification of the application state*
|
||||
+ *replica sets ensure that pods are running at any given time even while replacing the pods*
|
||||
+ *configmaps manages secrets in the cluster*;
|
||||
this includes passing configurations between different pods;
|
||||
secrets are either set imperatively (in the command line) or declaratively (from a file)
|
||||
+ *namespaces separates application from each other*, similarly to namespacing found in programming languages — e.g., Rust with modules, C++ namespaces, etc.
|
||||
- while you can manage resources in the command line, you can create manifests that Kubernetes can simply apply
|
||||
+ think of it as declarative way of cluster management (i.e., with files) instead of imperative (i.e., invoking in the command line)
|
Loading…
Reference in New Issue
Block a user