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

it should be a command like:

kubectl apply -f

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

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
{"type":"main_options","images_arr":"'#ffffff'","enable_ajax":"off","soundcloud_apikey":"","bg_isparallax":"off","bg_slideshow_time":"0","bg_transition":"slidedown","site_url":"https:\/\/","theme_url":"https:\/\/\/wp-content\/themes\/qucreative\/","blur_ammount":"26","width_column":"50","width_section_bg":"","width_gap":"30","border_width":"0","border_color":"#ffffff","translate_cancel_comment":"Cancel reply","translate_leave_a_comment":"Leave a comment","translate_leave_a_comment_to":"Leave a comment to","is_customize_preview":"off","width_blur_margin":"30","gallery_w_thumbs_autoplay_videos":"off","content_enviroment_opacity":"30","menu_enviroment_opacity":"70","base_url":"https:\/\/"}