mirror of
https://github.com/ION606/learn.git
synced 2026-05-14 21:06:56 +00:00
2.2 KiB
2.2 KiB
Communicating with the Master Node
Format
a request must be in YAML format and has:
-
apiVersion
- the api version
-
kind
- the kind of thing this is referring to (Service, Deployement, etc)
-
metadata
- name of component
- matchLabels (labels)
- this is like a tag for that component to be matched by
selectors - this is ONLY used by selectors ONE LAYER UP (i.e. service --> deployement/pods)
- this is like a tag for that component to be matched by
-
spec (specification)
- any configurations you might need (selector, port, etc)
- this will be
kindspecific - this section will be expanded on down below
-
status
- this is automatically generated by kubernetes
★ for example, if you putreplicas: 2underspec, kubernetes will add a status that lets it know that only 1 state is currently running, then continuously update it as new replicas are added or removed, change the number of replicas accordingly - kubernetes gets this data from the
etcdand compares it to your request
★ YAML is horrid, so consider using a tool like https://yamlchecker.com/
- this is automatically generated by kubernetes
The Spec Field
This gets it's own section because it can contain so many things. For example:
Pod Blueprints
- stored in the
templatefield, these are the blueprints for the pods - these will have their own
specandmetadatafields in them - like nested configuration files as pods need their own configuration "files" inside of the deployement's configuration file
Selectors
- tells the deployement what
labelto match - this is ONLY used by selectors ONE LAYER DOWN (i.e. deployement/pods --> service)
Ports
- the service has a port where it is accessible at
- this is the
portvariable
- this is the
- the service also needs a protocol which it is accessible by
- this is the
protocolvariable
- this is the
- the service also needs to know what port the pod to be contacted is listening on
- this is the
targetPortvariable
- this is the
- the pod has a port it is listening on
- this is the
containerPortvariable
- this is the
Note: these files are declarative, so for example if you specify there must be 3 replicas, kubernetes will try to ensure there are three replicas