Tips and tricks

Link a microservice application to google cloud

Get a google cloud account

Install Google Cloud SDK

Run the command

gcloud auth

From GCloud enable:

  • Kubernetes Engine API
  • Google Cloud Build API

create a cluster in Kubernetes

Run the command:

gcloud init

Select the project:

gcloud config set project $MY_PROJECT_ID

select your CLUSTER

gcloud container clusters get-credentials YOUR_CLUSTER_NAME  --zone us-central1-c

Select the kubectl context:

kubectl config get-contexts
kubectl config use-context $CONTEXT_ID

in order to add secrets use this command

k create secret generic jwt-secret --from-literal=JWT_KEY=123

you will have to deploy ingress

https://kubernetes.github.io/ingress-nginx/deploy/#gce-gke

it should be a command like:

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.3.1/deploy/static/provider/cloud/deploy.yaml

check the ingress service ip address if you want to add to your hosts file

kubectl get service ingress-nginx-controller --namespace=ingress-nginx
Other notes

received an email stating I should install Gke-Gcloud-Auth-Plugin

gcloud components install gke-gcloud-auth-plugin
images

check the skaffold.yaml and other deployments and update gcloud project image

if you want to check the current pods

kubectl get pods --namespace=all -o=wide
kubectl get services --namespace=all -o=wide
kubectl get all

other useful commands

get current gcloud config

gcloud config list
gcloud config configurations list
gcloud auth list
gcloud config set account `ACCOUNT`

if you want to link hosts file to a domain, you can find the ip in the cluster endpoint

34.171.91.237 ticketing.dev

Leave a comment

Your email address will not be published

{"type":"main_options","images_arr":"'#ffffff'","bg_slideshow_time":"0","site_url":"https:\/\/digitalzoomstudio.net","theme_url":"https:\/\/digitalzoomstudio.net\/wp-content\/themes\/qucreative\/","is_customize_preview":"off","gallery_w_thumbs_autoplay_videos":"off","base_url":"https:\/\/digitalzoomstudio.net"}