Total WebSite Views Count

Devops Useful Command for Docker And Kubernates

DockerCommand
Bash shell to running dockerdocker exec -it 56a93cc76fde /bin/bash
Run nginxdocker run --name nginx -p 80:80 nginx
  
Minikube 
  
Kubernetes 
Master statelesskubernetes mater is stateless so we can start 5 masters if we want. 3 masters per 5000 nodes maybe.
DaemonSetenforces a single pod on each node (with filtering)
Serviceimplemented by iptables, creates A record in DNS pod in control plane of k8s.
KubeProxyprocess the brain behind service it’s updating the iptables. packets not going through it.
PortsContainers on same pod cannot have same port on different pods can have. On same port communicate via same loopback network interface.
Readiness/LivenessReadiness => false, removed from LB, Liveness => false, kubectl kills pod.
get labels for podkubectl get pod --show-labels
services endpointskubectl get endpoints
Expose as a service`kubectl expose
NodePortExposes the service on each Node’s IP at a static port (the NodePort ). A ClusterIP service, to which the NodePort service will route, is automatically created. You’ll be able to contact the NodePort service, from outside the cluster, by requesting : .
Get host where node runskubectl get pod -owide
Service Exposure ip/portClusterIp exposure (k8s) < NodePort exposure (vms) < LoadBalancer exposure (world). kubectl expose deployment tomerbdhost --name my-svc --type [ClusterIp|NodePort|LoadBalancer] --port 3000 --target-port 3000
Expose LoadBalancerIt knew to automatically go to GCP and expose it on google load balancer in google console search for Load Balancers in google cloud console and this will be your external ip you just need to run the above command it autoamtically connect to one of your load balancers.
kubectl applyReupload kubernetes file yaml kubectl apply -f host-id-deployment.yaml
Scheduling 
Node affinityIf you want to control that some pods are on same node so when the pods communicate they are affinity to same node. Or use labels to have pods on same zone or region
labelskubectl label set something, define labels and then assign pods to labels for nodes
node affinitylike labels selector but more advanced best effort
IngressIngress is data (rules) ingress controller process that reads it that the outcome is nginx!
 kubectl create -f ingress.yaml
 You must define also IngressController which loads ingress rules to load balancer.
 We do SSL termination with the nginx and its config (ingress)
NamespacesIn between namespaces add FQDN as prefix to DNS.
Clusterskubectl config get-clusters
 less ~/.kube/config
kubectl 
get podskubectl get pod -o wide
print yamlkubectl get ingress -o yaml # print yaml for my ingress
 kubetl get <id> -o yaml
 kubectl edit ds # edit DatemonSet yamls
lskubectl exec etcd-0 -- ls -ltr /var/run/etcd
watchkubectl get pods -w
delete podkubectl delete pod <podname>
delete by filekubectl delete -f persistency/etcdCluster.yaml
labelskubectl get node —show-labels
Volumes 
Dynamic claimsYou can have dynamic claims so like in statefulSets volumes are created dynamically for them.
Networking 
docker bridgeDocker host creats br0 bridge
docker vethevery container has veth interface
kuberentes differentpod can communicate with another on the cluster
NodePortexport service port on VM
Pod networkingCNI - Container Network Interface - —network-plugin=cni plugin for networking simulating hardware for kubernetes.
—network-plugin=kubenetdocker networking, then we need to configure routing or our cloud provider gives us the ip, but cannot do overlay networks, in cloud we are given the networking
—network-plugin=cniwith this we don’t use docker networking we use custom like flannel, in on premise very important to know to choose, like cni that does firewall or not? today in our cluster all pods can tlak to all pods, so we need to choose the cni. with cni we write custom configuration for networking.
Overlay networkabstraction above multiple networks so it simulates a single network like layer 2 as if we ar eon same switch however we are on mutiple networks.
flannelis one of the cni, its like sitting on exit-entry of vm’s and knwos to translate internally to the pods and externally to other machines.
preserve source ipThe only way to preserve client source ip is by using external traffic policy OnlyLocal load balancer will remove any vm without pods all traffic will go to local pod traffic always goes to local pod on node.
StatefulSetskind: StatefulSet, Pets (not cattle), loading with same ip, with permanent storage, same identity
 kubectl get statefulset
Securitytwo entities, users (us), service-accounts - in cluster api access for services.
ItemCommand
  
run containerdocker run -p 3000:3000 tomerbd/tomerbdhost:1.0
gcloudgcloud container clusters get-credentials tomer-ben-david --zone europe-west1-b --project cldz-course-thomsonreuters
kubectl runkubectl run tomerbdhost --image tomerbd/tomerbdhost:1.0 --port=3000 # => run our image at google cloud
get pods shell accekubectl get pod ; kubectl exec -it tomerbdhost-2796297851-s5xmw sh
Expose to NodePortkubectl expose deployment tomerbdhost --name tomerbdhost-svc --type NodePort --port 3000 --target-port 3000
Ingresskubectl create -f ingress.yaml

AWS Services

AWS Services

Technology Selection & Evaluation Criteria

Technology Selection & Evaluation Criteria

Scale Cube - Scale In X Y Z Cube

Scale Cube - Scale In X Y Z Cube

Feature Post

AWS Services

About Me

About Me

Spring Cloud

Spring Cloud
Spring Cloud

Spring Cloud +mCloud Native + Big Data Archittect

Spring Cloud +mCloud Native + Big Data Archittect

ACID Transaction

ACID Transaction

Data Pipe Line Stack

Data Pipe Line Stack

Popular Posts