Resources : Objects
service pod deployment
workload:pod,ReplicaSet,Deployment,statefulset,DaemonSet,Job,Crontabjob,...
Service Discovery and balanced : service, Ingress, ....
Stored configuration : Volumn storage volume , CSI storage interface
ConfigMap,Secret,
DownwardAPI
Cluster-level resources : namespace, Node, Role, ClusterRole , RoleBinding, ClusterRoleBinding,
Metadata type resources
HPA PodTemplate, LimitRange
kubectl get pod myapp-84cd4b7f95-h47cj -o yaml
yml file viewing pod detailed configuration list
Create a method resources:
apiserver receives only JSON resource definition format;
yaml format provides configuration list, apiserver can automatically be converted to json format, and then submitted
kubectl apiversions View all apiversions
Most resource configuration list :
apiVerison:group/version,
kind: resource category
the Metadata : Metadata
name
namespace
labels
annotations resource comment
Each resource reference PATH
/api/GROUP/VERSION/namespaces/NAMESPACE/TYPE/NAME
spec: Specifications desired state disired state
status: current status, Current State, this field consists kubernetes maintain the cluster; user not defined
kubectl explain pods query pods how the definition
kubectl explain pods.metadata query pods of metadata how the definition
kubectl explain pods.spec
kubectl explain pods.spec.containers
kubectl explain pods.spec.containers.livenessProbe
For example : Customize a pod list of resources
vim sub-demo.yaml
apiVersion: v1
kind: Pod
metadata:
name: pod-demo
namespace: default
labels:
app: myapp
tier: frontend
spec:
containers:
- name: myapp
image: ikubernetes/myapp:v1
- name: busybox
image: busybox:latest
Comment:
spec:
containers:
- name: myapp
image: ikubernetes/myapp:v1
Corresponds to the spec: {containers: [ 'name: myapp'], image: "ikubernetes / myapp: v1"}
command:
- "/bin/sh"
- "-c"
- "sleep 3600"
Corresponds to the command: [ "/ bin / sh", "- c", "sleep 3600"]
kubectl create -f pod-demo.yaml create pod-based resource manifest file yaml
Create a resource from a file is loaded
kubectl get pods and then look at the creation of the pod
kubectl describe pods pod-demo to see the creation of resource description information
View container logs
kubectl logs pod-demo myapp
pod name pod inside the container name
Into the container
kubectl exec -it pod-demo -c myapp -- /bin/sh
And input terminal pod name -c specified container name - command to execute
kubectl delete -f pod-demo.yaml deleted based on the resource list yaml resource definition file