Kubernates 3 Flashcards
What does kubectl expose deployment k8s-web-hello --port=3000
do?
kubectl expose deployment k8s-web-hello
tells kubernates to create a service that exposes the deployment named k8s-web-hello
--port=3000
is a flag that specifies the port on the service that will be exposed to the outside world.
kubectl expose deployment <name-of-deployment> --port=<port_number>
This command will create a service that routs trafic to the pods managed by the deployment
How would you list all the services currently running?
kubectl get svc
How would you scale a deployment to have more pods?
kubectl scale deployment <deployment_name> --replicas=<number_of_replica>
EXAMPLE: kubectl scale deployment k8s-app --replicas=4
What is load balancing?
Distributes incoming network Traffic across multiplebackend servers, in the case of kubernates it will be pods
How would you update a deployment image?
kubectl set image deployment <deployment_name> <new_deployment>
Kubernates conducts a rolling update.
What is a rolling update/how it works/why is it beneficial?
Rolling updates work by replacing instances of old versions with new ones.
If something goes wrong during deployment, kubernates can automaticly roll back all instances to the old version
What does kubctl rollout status deploy k8s-app
do?
checks the rollout status of the deployment k8s-app
What happens if a pod is deleted in kubernates?
Kubernates will automaticly replace it
How to open the kubernates dashboard?
minikube dashboard
How would you delete all resources in the current namespace?
kuberctl delete all --all
Simple Kubernetese resources can be created with kubectl, however what could we use to create more complex ones?
Manifest files.
This is a YAML
or JSON
files that define resources such as pods, deployments and services.
These are used to create, update and delete resources