persistent entities
All objects in REST API are identified by a Name(such as /api/v1/pods/some-name) and a UID.
For non-unique user-provided attributes, Kubernetes provides labels and annotations.
namespaces
multiple virtual clusters backed by the same physical cluster
kubectl get namespaces
NAME STATUS AGE
default Active 59d
ibm-cert-store Active 59d
ibm-system Active 59d
kube-public Active 59d
kube-system Active 59d
default: for objects with no other namespace
kube-system: created by the Kubernetes system
kube-public: readable by all users. reserved for cluster usage, in case that some resources should be visible and readable publicly throughout the whole cluster. The public aspect of this namespace is only a convention, not a requirement
controllers
ReplicaSet
ReplicaSet is the next-generation Replication Controller.
ReplicaSet supports the new set-based selector requirements
kubectl get pods -l 'environment,environment notin (frontend)'
Replication Controller
only supports equality-based selector requirements.
kubectl get pods -l environment=production,tier=frontend
pod (po), service (svc), replicationcontroller (rc), deployment (deploy), replicaset (rs)
# Create a service for a replicated nginx, which serves on port 80 and connects to the containers on port 8000.
kubectl expose rc nginx --port=80 --target-port=8000
# Create a service for a replication controller identified by type and name specified in "nginx-controller.yaml",
which serves on port 80 and connects to the containers on port 8000.
kubectl expose -f nginx-controller.yaml --port=80 --target-port=8000
# Create a service for a pod valid-pod, which serves on port 444 with the name "frontend"
kubectl expose pod valid-pod --port=444 --name=frontend
# Create a second service based on the above service, exposing the container port 8443 as port 443 with the name
"nginx-https"
kubectl expose service nginx --port=443 --target-port=8443 --name=nginx-https
# Create a service for a replicated streaming application on port 4100 balancing UDP traffic and named 'video-stream'.
kubectl expose rc streamer --port=4100 --protocol=udp --name=video-stream
# Create a service for a replicated nginx using replica set, which serves on port 80 and connects to the containers on
port 8000.
kubectl expose rs nginx --port=80 --target-port=8000
# Create a service for an nginx deployment, which serves on port 80 and connects to the containers on port 8000.
kubectl expose deployment nginx --port=80 --target-port=8000
Generally useful for this to ALWAYS be visible to an operator.
--v=1
A reasonable default log level if you don’t want verbosity.
--v=2
Useful steady state information about the service and important log messages that may correlate to significant changes in the system. This is the recommended default log level for most systems.