#Deployment Step
#Set up Kubernetes cluster Step
- Register a new account on GOOGLE Cloud Platform
- Create a new project
- Enable Kubernetes Engine API
- Install Google Cloud SDK on your local machine (https://cloud.google.com/sdk/docs/install)
- brew install google-cloud-sdk // install google cli
- gcloud --version // check google cloud version
- gcloud auth login // login gcloud by your account
- gcloud config set project [project-id]
- Create a new Kubernetes cluster
- gcloud container clusters create [cluster-name] --machine-type=e2-micro --zone-us-west1-a --num-nodes=2
- gcloud container clusters get-credentials [cluster-name] --zone us-west1-a // to get the credentials for the cluster
##Set Up Mongo Kubernetes
- create secret file ./deployments/mongo/secret.yaml
- encode value as base64 (echo -n 'xxxxxxxx' | base64)
- kubectl apply -f ./deployments/mongo-secret.yaml
- kubectl get secrets // to check the secret {secret name from metadata name}
- create deployment file ./deployments/mongo-deployment.yaml
- kubectl apply -f ./deployments/mongo/deployment.yaml
- kubectl get pods // to check the pod
- create service file ./deployments/mongo/service.yml
- kubectl apply -f ./deployments/mongo/service.yaml
- kubectl get services // to check the service that we open port 27017
- testing connect to mongodb
- kubectl get services // to get all service and port of all services
- kubectl port-forward service/mongodb-service 27017:27017 // [local:remote-service-port] to forward port
##Set Up Redis Kubernetes
- create deployment file ./deployments/redis/deployment.yaml
- kubectl apply -f ./deployments/redis/deployment.yaml
- kubectl get pods // to check the pod
- create service file ./deployments/redis/service.yml
- kubectl apply -f ./deployments/redis/service.yaml
- kubectl get services // to check the service that we open port 6379
- testing connect to redis
- kubectl get services // to get all service and port of all services
- kubectl port-forward service/redis-service 6379:6379 // [local:remote-service-port] to forward port
gcloud config get-value project // to get the project id
gcloud artifacts repositories create team33-repo
--project=cs599-cloud
--repository-format=docker
--location=us-west1
--description="Docker repository"
gcloud builds submit
--tag us-west1-docker.pkg.dev/cs599-cloud/team33-repo/api .
- gcloud compute addresses create static-ip --global
// create endpoint mapping to static ip address 2. gcloud endpoints services deploy ./deployments/endpoint-dns.yaml