namikingsoft / k8s-sandbox

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sandbox of k8s on GKE

curl https://sdk.cloud.google.com | bash
gcloud auth login
gcloud config set project name_of_project
gcloud config set project name_of_project
gcloud config set compute/zone name_of_region
gcloud container clusters get-credentials name_of_cluster
gcloud components install kubectl

cluster

gcloud beta container clusters create clustertest \
  --zone us-central1-a \
  --machine-type n1-standard-1 \
  --enable-autoscaling \
  --min-nodes 1 \
  --max-nodes 5 \
  --disk-size 10 \
  --preemptible

nginx

kubectl create -f nginx.yaml
kubectl delete -f nginx.yaml

job

kubectl create -f job.yaml
kubectl delete -f job.yaml

kubectl run pi --image=perl --restart=OnFailure --\
  perl -Mbignum=bpi -wle 'print bpi(2000)'
kubectl delete job --all

# foreground
kubectl run sh --image=busybox -it --attach --rm --restart=OnFailurer -- sh

pod

kubectl run sh -it --attach --image=busybox --restart=Never --rm -- sh

About