NOTE: WIP - This README is NOT complete and the steps have to be validated!
Messing around with Kubernetes.
This project works with kubernetes to test, build and start an unnecessarily complex app to work with multiple containers and integrating them.
Based on the Udemy course: Docker and Kubernetes: The Complete Guide by Stephen Grider starting at Section 12: "Onwards to Kubernetes!" project begins at Section 16: "Kubernetes Production Deployment"
- node (
brew install node
) - docker (
App Store install: Docker Desktop
) - terraform (
brew install terraform
) - git (
brew install git
)
git clone https://www.github/pataraco/d4r-k8s.git
I'm using a Jenkins
server for CI/CD. You'll need to set up your own CI/CD
server and configure it properly to work with this project. If you do use
Jenkins
, at least you'll get a (good?) example of a Jenkinsfile
.
- AWS credentials in ~/.aws/config (TODO: or GCP credentials [wherever they go])
- Docker Hub credentials as Jenkins environment vars in global config
- Create/Modify Jenkinsfile
- Jenkins
- multibranch project
- specify the correct Jenkinsfile (in
fibo-k8s
directory) - set up the GitHub creds (username/password) standard or Pers Access Token
These steps assume you are using MAC O.S.
and Docker for Desktop
(you can also use minikube
).
- Make sure your
kube config
is properly set up and that you are using the specific context in which you want to create/deploy containers in to
kubectl config get-contexts
kubectl config current-context
kubectl config use-context CONTEXT
- Create the project's namespace (apply the namespace config)
kubectl apply -f kubernetes/fibo-namespace.yaml
- Change the password in the postgres secrets config
vi kubernetes/postgres/postgres-secrets.yaml
- Deploy the containers (apply the configs)
kubectl apply -f kubernetes/postgres
kubectl apply -f kubernetes/redis
kubectl apply -f kubernetes/server
kubectl apply -f kubernetes/worker
kubectl apply -f kubernetes/client
- Deploy
nginx
ingress (go tokubenetes/ingress-nginx
github and follow instructions for deployment) - Set up up the
kubernetes dashboard
GitHub:kubernetes/dashboard
- Follow instructions for
local
set up and use the following arguments:
args:
- --auto-generate-certificates
- --enable-skip-login
- --disable-settings-authorizer
TODO:TBD
Note: The terraform
configs are specific to my environment. You'll have
to change the "hard-coded" values (that's right - I didn't parameterize! :-p)
- Change working directory to
terraform/gcp
cd terraform/gcp
- Initialize
terraform
terraform init
- Apply the
terraform
configurations
terraform apply
WIP:Draft
- log into GCP and create a project
- enable kubernetes engine and create a cluster
- name / zonal / closest zone / 3 nodes / 1 vCPU / 3.75 GB
TODO:TBD
Note: The terraform
configs are specific to my environment. You'll have
to change the "hard-coded" values (that's right - I didn't parameterize! :-p)
- Change working directory to
terraform/aws
cd terraform/aws
- Initialize
terraform
terraform init
- Apply the
terraform
configurations
terraform apply
TODO:TBD
- AWS VPC/Subnets/NAT GW/Security Groups
- TBD
- AWS EKS
- TBD
- AWS EC2 - Instances: K8S Worker Nodes
- TBD
- AWS EC2 - Load Balancers: K8S Worker Nodes
- TBD
- AWS Route 53
- TBD