Difference between revisions of "Google Kubernetes Engine"

From berki WIKI
Jump to: navigation, search
Line 1: Line 1:
  
  
 +
=Regisztráció a Google Cloud Platform-ban=
 +
https://console.cloud.google.com
  
 
Kubernetes Engine API aktiválása a projektben:  
 
Kubernetes Engine API aktiválása a projektben:  
Line 13: Line 15:
 
...
 
...
  
 +
A baloldali fő menüben megjelent a Kubernetes Engine menüpont:
 +
:[[File:ClipCapIt-190622-000203.PNG]]
  
 +
=Google Cloud SDK installálása=
  
 +
Install google cloud sdk:
 +
 +
# sudo tee -a /etc/yum.repos.d/google-cloud-sdk.repo << EOM
 +
[google-cloud-sdk]
 +
name=Google Cloud SDK
 +
baseurl=https://packages.cloud.google.com/yum/repos/cloud-sdk-el7-x86_64
 +
enabled=1
 +
gpgcheck=1
 +
repo_gpgcheck=1
 +
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg
 +
      https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
 +
EOM
 +
 +
 +
# dnf install google-cloud-sdk
 +
# gcloud init
 +
..
 +
You must log in to continue. Would you like to log in (Y/n)?
 +
...
 +
browser login
 +
 +
# gcloud projects create adamproject1
 +
Create in progress for [https://cloudresourcemanager.googleapis.com/v1/projects/adamproject1].
 +
 +
# gcloud projects list
 +
PROJECT_ID              NAME              PROJECT_NUMBER
 +
adamproject1            adamproject1      206600067398
 +
 +
 +
# gcloud config set project adamproject1
 +
 +
- az új projektet hozzá kell rendeli egy billing account-hoz (amihez a bankszámlát beállítottuk
 +
- be kell rajta kapcsolni a Kubernetes Engine API-t.
 +
https://console.cloud.google.com/apis/library/container.googleapis.com?project=adamproject1
 +
 +
Ez a kubctl -t is át fogja állítani a google cloud-ra.
 +
 +
 +
De ha elindítjuk a minikube-ot, akkor az vissza fogja állítani a kubectl-t saját magára:
 +
<pre>
 +
# minikube start
 +
...
 +
 +
# kubectl config current-context
 +
minikube
 +
 +
 +
# kubectl get node
 +
NAME      STATUS  ROLES    AGE    VERSION
 +
minikube  Ready    master  103d  v1.13.4
 +
</pre>
 +
 +
 +
 +
=Klaszter létrehozás=
 
<pre>
 
<pre>
 
To inspect the contents of your cluster, go to: https://console.cloud.google.com/kubernetes/workload_/gcloud/europe-west6/adam1?project=adamproject1
 
To inspect the contents of your cluster, go to: https://console.cloud.google.com/kubernetes/workload_/gcloud/europe-west6/adam1?project=adamproject1
Line 20: Line 80:
 
NAME  LOCATION      MASTER_VERSION  MASTER_IP    MACHINE_TYPE  NODE_VERSION  NUM_NODES  STATUS
 
NAME  LOCATION      MASTER_VERSION  MASTER_IP    MACHINE_TYPE  NODE_VERSION  NUM_NODES  STATUS
 
adam1  europe-west6  1.12.8-gke.10  34.65.149.13  n1-standard-1  1.12.8-gke.10  3          RUNNING
 
adam1  europe-west6  1.12.8-gke.10  34.65.149.13  n1-standard-1  1.12.8-gke.10  3          RUNNING
 +
</pre>
 +
Menjünk a Kubernetes Engine felületre, és itt válasszuk a Cluster menüpontot: https://console.cloud.google.com/kubernetes
 +
:[[File:ClipCapIt-190621-235437.PNG]]
 +
 +
 +
<pre>
 +
# kubectl get nodes
 +
NAME                                  STATUS  ROLES    AGE    VERSION
 +
gke-adam1-default-pool-b9ed6fb1-d955  Ready    <none>  2m11s  v1.12.8-gke.10
 +
gke-adam1-default-pool-c1ab468d-slqn  Ready    <none>  2m8s    v1.12.8-gke.10
 +
gke-adam1-default-pool-e3b15f3f-98dl  Ready    <none>  2m7s    v1.12.8-gke.10
 +
</pre>
 +
 +
 +
<pre>
 +
# gcloud container clusters delete adam1 --region europe-west6
 +
The following clusters will be deleted.
 +
- [adam1] in [europe-west6]
 +
 +
Do you want to continue (Y/n)?  Y
 
</pre>
 
</pre>

Revision as of 00:41, 22 June 2019


Regisztráció a Google Cloud Platform-ban

https://console.cloud.google.com

Kubernetes Engine API aktiválása a projektben:

ClipCapIt-190621-232945.PNG

Majd a keresőbe írjuk be, hogy Kubernetes. Ekkor bejön

ClipCapIt-190621-233149.PNG

Kattintsunk az Enable-re.

ClipCapIt-190621-233720.PNG

...

A baloldali fő menüben megjelent a Kubernetes Engine menüpont:

ClipCapIt-190622-000203.PNG

Google Cloud SDK installálása

Install google cloud sdk:

  1. sudo tee -a /etc/yum.repos.d/google-cloud-sdk.repo << EOM

[google-cloud-sdk] name=Google Cloud SDK baseurl=https://packages.cloud.google.com/yum/repos/cloud-sdk-el7-x86_64 enabled=1 gpgcheck=1 repo_gpgcheck=1 gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg

      https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg

EOM


  1. dnf install google-cloud-sdk
  2. gcloud init

.. You must log in to continue. Would you like to log in (Y/n)? ... browser login

  1. gcloud projects create adamproject1

Create in progress for [1].

  1. gcloud projects list

PROJECT_ID NAME PROJECT_NUMBER adamproject1 adamproject1 206600067398


  1. gcloud config set project adamproject1

- az új projektet hozzá kell rendeli egy billing account-hoz (amihez a bankszámlát beállítottuk - be kell rajta kapcsolni a Kubernetes Engine API-t. https://console.cloud.google.com/apis/library/container.googleapis.com?project=adamproject1

Ez a kubctl -t is át fogja állítani a google cloud-ra.


De ha elindítjuk a minikube-ot, akkor az vissza fogja állítani a kubectl-t saját magára:

# minikube start 
...

# kubectl config current-context
minikube


# kubectl get node
NAME       STATUS   ROLES    AGE    VERSION
minikube   Ready    master   103d   v1.13.4


Klaszter létrehozás

To inspect the contents of your cluster, go to: https://console.cloud.google.com/kubernetes/workload_/gcloud/europe-west6/adam1?project=adamproject1
kubeconfig entry generated for adam1.
NAME   LOCATION      MASTER_VERSION  MASTER_IP     MACHINE_TYPE   NODE_VERSION   NUM_NODES  STATUS
adam1  europe-west6  1.12.8-gke.10   34.65.149.13  n1-standard-1  1.12.8-gke.10  3          RUNNING

Menjünk a Kubernetes Engine felületre, és itt válasszuk a Cluster menüpontot: https://console.cloud.google.com/kubernetes

ClipCapIt-190621-235437.PNG


# kubectl get nodes
NAME                                   STATUS   ROLES    AGE     VERSION
gke-adam1-default-pool-b9ed6fb1-d955   Ready    <none>   2m11s   v1.12.8-gke.10
gke-adam1-default-pool-c1ab468d-slqn   Ready    <none>   2m8s    v1.12.8-gke.10
gke-adam1-default-pool-e3b15f3f-98dl   Ready    <none>   2m7s    v1.12.8-gke.10


# gcloud container clusters delete adam1 --region europe-west6
The following clusters will be deleted.
 - [adam1] in [europe-west6]

Do you want to continue (Y/n)?  Y