Google cloud

Материал из noname.com.ua
Перейти к навигацииПерейти к поиску

Заметки

  • gcloud init --console-only
  • gcloud container clusters list
 gcloud container clusters list
NAME                    ZONE           MASTER_VERSION  MASTER_IP       MACHINE_TYPE   NODE_VERSION  NUM_NODES  STATUS
amp-kubernetes-cluster  us-central1-b  1.4.8           104.198.73.45   n1-standard-2  1.4.7 *       5          RUNNING
k-poc-search-1          us-central1-b  1.4.8           104.198.72.131  n1-standard-4  1.4.7 *       4          RUNNING
k-poc-search-2          us-central1-b  1.5.2           104.154.220.59  n1-highmem-4   1.5.2         2          RUNNING
mmazur-sandbox-1        us-central1-b  1.5.2           104.198.34.251  n1-standard-1  1.5.2         3          RUNNING

Получить креденции (kubectl будет настроен автоматически)

  • gcloud container clusters get-credentials mmazur-sandbox-1
Fetching cluster endpoint and auth data.
kubeconfig entry generated for mmazur-sandbox-1.
kubectl get pods
No resources found.

Создать тестовый деплоймент

kubectl run hello-node --image=gcr.io/google-samples/node-hello:1.0 --port=8080
 kubectl expose deployment hello-node --type="NodePort"

Таким образом сервис будет доступен на всех нодах кластера на случайно выбранном порту

kubectl get service
NAME         CLUSTER-IP     EXTERNAL-IP   PORT(S)          AGE
hello-node   10.3.246.117   <nodes>       8080:31824/TCP   1m
kubernetes   10.3.240.1     <none>        443/TCP          13m


kubectl  describe service hello-node
Name:			hello-node
Namespace:		default
Labels:			run=hello-node
Selector:		run=hello-node
Type:			NodePort
IP:			10.3.246.117
Port:			<unset>	8080/TCP
NodePort:		<unset>	31824/TCP
Endpoints:		10.0.0.4:8080
Session Affinity:	None


Внешний Port --> 31824

Ссылки=

* http://containertutorials.com/get_started_kubernetes/k8s_example.html