|
| 1 | +## Deploy Microservices to Kubernetes cluster: |
| 2 | + |
| 3 | +### Create a K8s cluster on Google Cloud: |
| 4 | +* [Creating a cluster (Google Cloud project)](https://www.udemy.com/course/docker-and-kubernetes-the-complete-guide/learn/lecture/11628212#overview) |
| 5 | +* OR [Creating a cluster (LKE project)](https://techworld-with-nana.teachable.com/courses/1769488/lectures/39916812) |
| 6 | + * download and install [gcloud CLI](https://cloud.google.com/sdk/docs/install-sdk) |
| 7 | + * `./google-cloud-sdk/install.sh` - install script to add gcloud CLI tools to your PATH |
| 8 | + * `gcloud init` - initialize the gcloud CLI |
| 9 | + * log in using your Google user account |
| 10 | + * |
| 11 | +* [Google Cloud Cluster](https://console.cloud.google.com/kubernetes/clusters/details/me-west1/autopilot-cluster-1/details?project=fluent-oarlock-358313) |
| 12 | + * `gcloud auth list` - List accounts whose credentials are stored on the local system |
| 13 | + * `gcloud config list` - List the properties in your active gcloud CLI configuration |
| 14 | +* [Enable the Google Kubernetes Engine API](https://cloud.google.com/kubernetes-engine/docs/how-to/cluster-access-for-kubectl#default_cluster_kubectl) |
| 15 | +* `gcloud container clusters get-credentials autopilot-cluster-1 --region me-west1 --project fluent-oarlock-358313` - Update the kubectl configuration to use the plugin |
| 16 | +* `gke-gcloud-auth-plugin --version` - Check the gke-gcloud-auth-plugin binary version |
| 17 | +* `kubectl get namespaces` - Verify the configuration |
| 18 | +* `kubectl config view` - To view your environment's kubeconfig |
| 19 | +* `kubectl cluster-info` - connect to cluster and get info from it |
| 20 | + |
| 21 | + |
| 22 | +### Cluster configuration: |
| 23 | +* `kubectl create namespace my-micro-service` - create namespace |
| 24 | + * namespace/my-micro-service created |
| 25 | +* `kubectl create serviceaccount cicd-sa --namespace=my-micro-service` - create service account |
| 26 | + * serviceaccount/cicd-sa created |
| 27 | +* `vim cicd-role.yaml` - create cicd-role.yaml with role rules |
| 28 | +* `kubectl apply -f cicd-role.yaml` - create role |
| 29 | + * role.rbac.authorization.k8s.io/cicd created |
| 30 | +* `kubectl create rolebinding cicd-rb --role=cicd-role --serviceaccount=my-micro-service:cicd-sa --namespace=my-micro-service` - bind role with rules |
| 31 | + * rolebinding.rbac.authorization.k8s.io/cicd-rb created |
| 32 | +* |
0 commit comments