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:
kubectl
Domain with 2 endpoints (A records)
React and Spring Boot projects
mySQL or H2 database
dockerhub with dockers
Step-by-step
Create Spring Boot docker and push to dockerhub
Create React docker and push to dockerhub
Domains: on Digital Ocean, NameCheap or AWS Route53
Configure env var to define endpoints in both projects
Create cluster on k8s Digital Ocean (minimum two nodes)
Connect/Manage cluster via kubectl (need connection file from Digital Ocean)
Connect/Manage cluster via doctl (need token from Digital Ocean)
Create k8s secrets (for mySQL)
Deploy mySQL on k8s on persistent Volume (k8s/mysqlbooks.yml)
kubectl apply -f k8s/mysql.yml
Deploy Spring Boot on K8s cluster (k8s/sprintbootbooks.yml)
kubectl apply -f k8s/sprintbootbooks.yml
Deploy React on K8s cluster (k8s/reactbooks.yml)
kubectl apply -f k8s/reactbooks.yml
Install k8s NGinx Ingress Controller (loadbalancer) or create it on Digital Ocean
kubectl apply -f deploy.yaml
Add domain to digital Ocean or create it on Digital Ocean
Create DNS/A records for React/Spring Boot
Publish/Expose React/SpringBoot ingress-nginx.yml
kubectl apply -f k8s/ingress-nginx.yml
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
Configure ingress to production (to https)
kubectl apply -f k8s/ingress-nginx-production.yml