Here are the objects we're covering: Containers, Pods, ReplicaSets, Services, Secrets, ConfigMaps, Deployments, jobs, DaemonSets
- Pods manage containers
- ReplicaSets manage Pods
- Services expose pod processes to the outside world
- ConfigMaps and Secrets help you configure Pods
- Labels are the plumbing that ties everything together (not covered in detail here)
- Deployments manage the change from one set of replicasets/pods to another (e.g. for a software release)
- represented as JSON or YAML files
- you create these and then push them to the kubernetes API with kubectl
- (or receive them as output from kubectl after it hits the kubernetes API for you)
Regardless of the type of object you're dealing with, the basic syntax is:
kubectl apply -f obj.yaml
You can interactively edit using
kubectl edit <resource-name> <obj-name>
This will:
- download a yaml representation of the object using the kubernetes API
- launch your $EDITOR on that textfile
- re-upload your saved changed using the Kubernetes API, which will re-evaluate that object definition and make the necessary changes.
If you've got a resource file (manifest) handy:
kubectl delete -f obj.yaml
or any object in the kubernetes system with:
kubectl delete <resource-name> <obj-name>
Like folders, used to organize objects If you don't specify one with --namespace, kubectl uses the 'default' namespace
More permanent namespaces (modifies your kubernetes config file at $HOME/.kube/config) Useful if you're managing multiple kubernetes clusters
kubectl config set-context my-context --namespace=mystuff kubectl config use-context my-context