what is a pod - answer- abstraction of a server, minimal entity that can be managed by
k8s
- can contain multiple containers that has shared resources (volumes/ect) exposed by a
single IP address
- in real-work scenarios: pods are started through deployments
declarative vs imperative approach - answer imperative using the kubectl commands
(useful on exam)
declarative using yaml files (how it's done on real work for automation and checked-in
configs)
what is a sidecar container - answer- enhances or provides additional functionality to
the main container where it makes no sense on running on separate pod
- e.g logging, monitoring, synching
- the key is that the main container and the sidecar have access to shared resources to
pass info (e.g. volumes)
what is an ambassador container - answer- represents the primary container to the
outside world such as a proxy
- in java design pattern, think of front controller pattern
- in spring world, think dispatcherservlet
what is an adapter container - answeradopt the traffic or data pattern to match the traffic
or data pattern in other applications in the cluster
create namespace - answerkubectl create ns <name>
show all pods in all namespaces - answerkubectl get pods -A
or
kubectl get pods --all-namespaces
basic fields on all yaml resources - answerapiVersion, kind, metadata, spec
create a namespace in declarative way (generate yaml) - answerkubectl create ns
<namespace> --dry-run=client -o yaml
setup nano to be default k8s editor - answerexport KUBE_EDITOR=nano
edit file using nano with tab as 2 spaces - answernano <filename> -ET2
, split terminal window (so 1 is terminal, 1 for kubectl explain) - answertmux
ctrl+b to send command to tmux
list of commands after ctrl+b
% (to create a new vertical split)
" (to create a new vertical split)
o (to switch between splits)
x (to remove the split)
setup kubectl autocomplete and alias for kubectl -
answerhttps://kubernetes.io/docs/reference/kubectl/cheatsheet/ (bookmark this!)
env variables shortcut - answersudo -i (to eliminate any further issues later that might
required root)
alias kgc="kubectl config get-contexts"
alias ksc="kubectl config set-context --current --namespace"
export dr="--dry-run=client -o yaml"
export f="--force --grace-period=0"
defines privilege and access control settings for pod - answerSecurityContext
securitycontext how to use - answerpod.spec.securityContext
runAsNonRoot
runAsUser
fsGroup
pod for limited duration - answerjob (e.g. tasks like backup, calculation, batch
processing, etc)
job must have its restartPolicy to OnFailure or Never
- OnFailure will rerun the failing container on same pod
- Never will rerun failing container in a new pod
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller Dreamer252. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $15.99. You're not tied to anything after your purchase.