Shared Flashcard Set

Details

Kubernetes Sec 2
CKA
42
Computer Science
Professional
08/06/2020

Additional Computer Science Flashcards

 


 

Cards

Term
Kube-api Server
Definition
- Auth User
- Val req
- Retrieve data
- Only service that updates ETCD
- Talks to Scheduler
- Talks to Kubelet
Term
Kube-Controller-Manager
Definition
Single process that manages all controllers
Term
Kube-Scheduler
Definition
- Decides which pods go on which nodes
- Filters based on # cpu's, mem, etc.
- Ranks remaining nodes (0-10) where nodes with larger # remaining resources after pod install gets higher score
Term
Kubelet
Definition
- control actions on nodes
- loads pods
- talks to kube-apiserver
- talks to docker
Term
kube-proxy
Definition
- process that runs on each node
- allows nodes to access each other without IP's in the POD NW
- uses ip tables
Term
PODs
Definition
- encapsulates docker containers
- single instance of an app
- different containers can exist in same pod but not same container in same pod
- share same localhost and memory in a single pod and have same fate (are created or die together)
Term
Kubernetes YAML file
Definition
- must have apiVersion, kind, metadata, spec
Term
kubectl create -f <>.yaml
Definition
create pod
Term
kubectl delete pod
Definition
Delete pod named
Term
kubectl describe pod
Definition
Get details about
Term
yaml sections
Definition
apiVersion: v1
kind: Pod
metadata:
name: "pod name"
labels:
app: "label"
spec:
containers:
- name: "container name"
image: "image name"
Term
To see what nodes a pod is running on
Definition
kubectl get pods -o wide
Term
pod logs
Definition
kubectl logs "pod"
Term
Replication Controller
Definition
- Ensures the number of specified pods is always running (1 or more)
- Load Balancing & scaling across a single node or multiple nodes
- Being replaced by replica set
Term
kubectl get replicationcontroller
Definition
show rep contrl info
Term
ReplicationController yaml
Definition
- apiVersion: v1
- kind: ReplicationController
- metadata:
- spec:
template:
metadata:
name:
labels:
app: "label"
spec:
selector:
app: "label"
replicas: #
Term
ReplicaSet Yaml
Definition
- apiVersion: apps/v1
- kind: ReplicaSet
- metadata:
- spec:
template:
metadata:
name:
labels: "label"
spec:
selector:
matchLabels:
app: "label"
replicas: #
Term
Basic Yaml
Definition
apiVersion:
kind:
metadata:
name:
labels:
app:
type:
spec:
containers:
- name:
image
Term
Increase/Decrease Replicas
Definition
- Change yaml file and recreate
- kubectl scale --replicas=# -f rs.yaml
- kubectl scale replicaset "rs name" --replicas=#
- kubectl scale deployment "dep name" --replicas=#
Term
Delete rs
Definition
kubectl delete replicaset rs-name
Term
To edit running rs
Definition
kubectl edit rs rs-name
Term
Deployment Yaml
Definition
- Same as RS
- kind: Deployment
Term
kubectl shortcuts
Definition
kubectl get pods,rc,rs,deploy,svc, all
Term
create pod imperative
Definition
kubectl run --generator=run-pod/v1 nginx --image=nginx (--dry-run -o yaml)
Term
2 ways create deploy
Definition
kubectl create deployment --image=nginx nginx (--dry-run -o yaml)
kubectl run "dep name" --image=nginx
Term
kubectl create vs apply
Definition
- create = creates whole new object
- apply = updates existing object
Term
Show deployment apps
Definition
kubectl get deployment.apps
Term
namespaces
Definition
- default namespaces
- default,kube-system,kube-public
- "svc name"."namespace".svc.cluster.local
- namespace yaml:
apiVersion: v1
kind: Namespace
metadata:
name: "namespace"
- deploy,rs,rc yaml:
metadata:
namespace: "namespace"
Term
get/create ns
Definition
- kubectl get namespace or "ns for short"
- kubectl get pods --namespace="namespace" (or -n="namespace")
- kubectl create ns "namespace"
- kubectl create -f namespace.yaml
- kubectl config set-context $(kubectl config current-context) --namespace="namespace"
- kubectl get pods --all-namespaces
Term
Imperative vs Declarative
Definition
- imp
- kubectl app
- yaml files
- Dec
- all kubectl cmds except apply
Term
kubectl replace -f file.yaml
Definition
- to apply changes in yaml to running config (saved locally)
- --force will delete and recreate
Term
kubectl apply
Definition
- -f file.yaml
- -f /path_to_files/*
- no need to worry if objs already exist
Term
Create a service
Definition
- kubectl expose pod "pod" --name="srv" --type=NodePort --port=8- --target-port=80
- kubectl create service nodeport "srv" --tcp="port":"targetport"
Term
Service Types
Definition
- NodePort - int access by ext
- CluserIP - VIP created for int pods
- LoadBalancer
Term
service ports
Definition
- TargetPort - port on pod
- port - port on service
- NodePort - port on node for ext use
- range = 30000 - 32767
Term
Service yaml
Definition
apiVersion: v1
kind: Service
metadata:
name: myapp-service
spec:
type: NodePort
ports:
- targetPort: 80 (assume = port if not given)
port: 80
nodePort: 30000 (auto assign if not given)
selector:
app: web
Term
Binding Scheduler yaml
Definition
apiVersion: v1
kind: Binding
metadata:
name:
target:
apiVersion: v1
kind: Node
name: "nodename"
Term
To see if a scheduler is running
Definition
kubectl -n kube-system get pods
Term
Get/Save running pod yaml
Definition
kubectl get pod "name" -o yaml > pod.yaml
Term
Create busybox with shell
Definition
kubectl run -i --tty busybox --image=busybox --restart=Never -- sh
Term
Change namespace cmd
Definition
kubectl config set-context --current --namespace=
Term
Service shortcuts
Definition
- kubectl get svc
- kubectl get ep
- endpoints
Supporting users have an ad free experience!