Skip to content

aivars-playground/getting-started-k8s-20250513

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

docker build - local

docker build -t example.com/frontend:1.0 ./App/v1/

creates example.com/frontend:1.0

docker build -t example.com/frontend:2.0 ./App/v2/

creates example.com/frontend:2.0

PODS - simple

kubectl apply -f ./Pods/pod.yml
kubectl get pods --watch

PODS - multi-container

kubectl apply -f ./Pods/multi-pod.yml

main and helper can talk on a localhost scraper exports nginx to prometheus logs...

kubectl get pods --watch
kubectl delete --all pods

ACCESSING POD

*as a service, ip can change, usually do not connect directly

kubectl get pods -o wide

service has ip and DNS, access by DNS

Services: imperative approach, create service as a command

  • programmatically expose hello-pod (from pod.yml)
kubectl apply -f ./Pods/pod.yml
kubectl expose pod hello-pod \
--name=hello-svc \
--target-port=8080 \
--type=NodePort
#does not work in docker
minikube ip
#192.168.49.2
kubectl get service
#hello-svc  8080:31515/TCP
curl http://127.0.0.1:31515
curl 192.168.49.2:31515
#hello-svc  8080:31515/TCP
#Services of type NodePort can be exposed via the minikube service <service-name> --url command. It must be run in a separate terminal window to keep the tunnel open. Ctrl-C in the terminal can be used to terminate the process at which time the network routes will be cleaned up.
minikube service hello-svc --url
# http://127.0.0.1:33053 Because you are using a Docker driver on linux, the terminal needs to be open to run it.
kubectl delete service --all
kubectl delete --all pods

Services: with service manifest (nodeport)

kubectl apply -f ./Pods/pod.yml
kubectl apply -f ./Services/svc-nodeport.yml
kubectl describe service ps-nodeport
minikube service ps-nodeport --url

Services: with service manifest (cloud loadbalancer!!!)

kubectl apply -f ./Pods/pod.yml
kubectl apply -f ./Services/svc-lb.yml
kubectl describe service ps-lb
minikube service ps-lb --url

Deployments:

kubectl apply -f ./Services/svc-lb.yml
kubectl apply -f ./Services/svc-nodeport.yml
kubectl apply -f Deployments/deploy.yml
kubectl delete service --all
kubectl delete pods    --all
kubectl delete deployment --all
kubectl get svc
kubectl get deployment
kubectl get pod
kubectl get rs
kubectl describe service ps-lb 
kubectl describe ep ps-lb 
kubectl get pods --show-labels
minikube service ps-lb --url

*starts browser automatically

minikube service ps-lb
minikube dashboard
  • tunnel to loadbalancer - 80
minikube tunnel
curl http://127.0.0.1/
  • scaling... change replicas, apply deploy

  • versioning

kubectl apply -f Deployments/deploy-complete.yml
kubectl rollout status deploy web-deploy

About

Code and YAML files for Getting Started with Kubernetes video course on Pluralsight

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Pug 24.8%
  • JavaScript 23.5%
  • Dockerfile 23.1%
  • CSS 15.9%
  • Handlebars 12.7%