Google Kubernetes Engine ( GKE ) クラスタを作ってみる
GKEのクラスタを作ってみる。
今回はクラスタをwebコンソールから作成した。
クラスタを作る
■ コンソールからクラスタを作成する
■ クラスタが作成された
■ GCEインスタンスが作成されている
■ kubectlセットアップ
$ gcloud components update
$ gcloud components update kubectl
■ gcloudを設定する
$ gcloud config configurations create k8s-dev $ gcloud auth login $ gcloud config set project k8s-dev $ gcloud config set compute/region us-central1 $ gcloud config set compute/zone us-central1-a $ gcloud config configurations list
$ gcloud container clusters get-credentials dev-cluster-1 --zone us-central1-a --project [PROJECT_ID]
→ ~/.kube/config
が作成される
Podを作る
■ pod-sample.yaml
apiVersion: v1 kind: Pod metadata: name: sample-pod spec: containers: - name: nginx image: nginx:1.13
■ $ kubectl apply -f pod-sample.yaml
■ $ kubectl get pods
NAME READY STATUS RESTARTS AGE sample-pod 1/1 Running 0 26m