k8s docean

K8S in digital Ocean and kubectl to manage

Install and Set Up kubectl on Windows

Create cluster on Digital Ocean

Connect kubectl to k8s cluster at docean

kubectl version Print the client and server version information

kubectl version --client=true

Client version only (no server required).

shell linux: export KUBECONFIG=C:\Users\AdministradorCIFO\Desktop\k8s-1-4-4-do-0-fra1-1757308432-kubeconfig.yaml

power-shell windows: $Env:KUBECONFIG = "C:\Users\AdministradorCIFO\Desktop\k8s-1-4-4-do-0-fra1-1757308432-kubeconfig.yaml"

Organizing Cluster Access Using kubeconfig Files

kubectl get Display one or many resources

kubectl create Create a resource from a file or from stdin.

kubectl expose Take a replication controller, service, deployment or pod and expose it as a new Kubernetes Service

kubectl run Run a particular image on the cluster

kubectl set Set specific features on objects

kubectl config Config modifies kubeconfig files

Spring Boot Kubernetes (short way)

This guide walks you through the process of deploying a Spring Boot application on Kubernetes.

Spring Boot Kubernetes (long way)

We need this tools:

Step-by-step


  1. Create Spring Boot docker and push to dockerhub

  2. Create React docker and push to dockerhub

  3. Domains: on Digital Ocean, NameCheap or AWS Route53

  4. Configure env var to define endpoints in both projects

  5. Create cluster on k8s Digital Ocean (minimum two nodes)

  6. Connect/Manage cluster via kubectl (need connection file from Digital Ocean)

  7. Connect/Manage cluster via doctl (need token from Digital Ocean)

  8. Create k8s secrets (for mySQL)

  9. Deploy mySQL on k8s on persistent Volume (k8s/mysqlbooks.yml)

      • kubectl apply -f k8s/mysql.yml

  10. Deploy Spring Boot on K8s cluster (k8s/sprintbootbooks.yml)

      • kubectl apply -f k8s/sprintbootbooks.yml

  11. Deploy React on K8s cluster (k8s/reactbooks.yml)

      • kubectl apply -f k8s/reactbooks.yml

  12. Install k8s NGinx Ingress Controller (loadbalancer) or create it on Digital Ocean

      • kubectl apply -f deploy.yaml

  13. Add domain to digital Ocean or create it on Digital Ocean

  14. Create DNS/A records for React/Spring Boot

  15. Publish/Expose React/SpringBoot ingress-nginx.yml

      • kubectl apply -f k8s/ingress-nginx.yml

  16. Install, Create and Configure Cert-Manger, ClusterIssuer, Stager ClusterIssuer and Production clusterIssuer

      • kubectl apply --validate=false -f k8s/cert-manager.yml

      • kubectl apply -f k8s/staging-issuer.yml

      • kubectl apply -f k8s/production-issuer.yml

  17. Configure ingress to production (to https)

      • kubectl apply -f k8s/ingress-nginx-production.yml