minikube起動 $ minikube start Starting local Kubernetes v1.8.0 cluster... Starting VM... Getting VM IP address... Moving files into cluster... Setting up certs... Connecting to cluster... Setting up kubeconfig... Starting cluster components... Kubectl is now configured to use the cluster. Loading cached images from config file.
at https://192.168.99.100:8443 To further debug and diagnose cluster problems, use 'kubectl cluster- info dump’. ## Nodeの⼀一覧表示 $ kubectl get nodes NAME STATUS ROLES AGE VERSION minikube Ready <none> 6d v1.8.0 # minikube って名前のnodeが⽴立ち上がった
deployment "kubernetes-bootcamp" created ## デプロイされたアプリの⼀一覧表示 $ kubectl get deployments NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE kubernetes-bootcamp 1 1 1 1 18s
--template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}') $ echo Name of the Pod: $POD_NAME Name of the Pod: kubernetes-bootcamp-6db74b9f76-4t8fc ## アプリにアクセス $ curl http://localhost:8001/api/v1/proxy/namespaces/default/pods/ $POD_NAME/ Hello Kubernetes bootcamp! | Running on: kubernetes- bootcamp-6db74b9f76-4t8fc | v=1 # kubernetes-bootcampアプリが⽴立ち上がった
default Node: minikube/192.168.99.100 Start Time: Sun, 17 Dec 2017 17:47:20 +0900 Labels: pod-template-hash=2863065932 run=kubernetes-bootcamp ・ ・ ・ Events: Type Reason Age From Message ---- ------ ---- ---- ------- Normal Scheduled 2m default-scheduler Successfully assigned kubernetes- bootcamp-6db74b9f76-4t8fc to minikube Normal SuccessfulMountVolume 2m kubelet, minikube MountVolume.SetUp succeeded for volume "default-token-2mz8l" Normal Pulled 2m kubelet, minikube Container image "docker.io/jocatalin/ kubernetes-bootcamp:v1" already present on machine Normal Created 2m kubelet, minikube Created container Normal Started 2m kubelet, minikube Started container
READY STATUS RESTARTS AGE kubernetes-bootcamp-6db74b9f76-4t8fc 1/1 Running 0 22m ## kubernetes-bootcampのServiceを表示 $ kubectl get services -l run=kubernetes-bootcamp NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes-bootcamp NodePort 10.108.145.126 <none> 8080:32593/TCP 17m
--template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}') $ echo Name of ths Pod : $POD_NAME Name of ths Pod : kubernetes-bootcamp-6db74b9f76-4t8fc ## app=v1というラベルを付与 $ kubectl label pod $POD_NAME app=v1 pod "kubernetes-bootcamp-6db74b9f76-4t8fc" labeled
default Node: minikube/192.168.99.100 Start Time: Sun, 17 Dec 2017 17:47:20 +0900 Labels: app=v1 pod-template-hash=2863065932 run=kubernetes-bootcamp ・ ・ ・ Events: Type Reason Age From Message ---- ------ ---- ---- ------- Normal Scheduled 28m default-scheduler Successfully assigned kubernetes- bootcamp-6db74b9f76-4t8fc to minikube Normal SuccessfulMountVolume 28m kubelet, minikube MountVolume.SetUp succeeded for volume "default-token-2mz8l" Normal Pulled 28m kubelet, minikube Container image "docker.io/jocatalin/ kubernetes-bootcamp:v1" already present on machine Normal Created 28m kubelet, minikube Created container Normal Started 28m kubelet, minikube Started container
default Node: minikube/192.168.99.100 Start Time: Sun, 17 Dec 2017 17:47:20 +0900 Labels: app=v1 pod-template-hash=2863065932 run=kubernetes-bootcamp ・ ・ ・ Events: Type Reason Age From Message ---- ------ ---- ---- ------- Normal Scheduled 19m default-scheduler Successfully assigned kubernetes- bootcamp-6db74b9f76-fs8c9 to minikube Normal SuccessfulMountVolume 19m kubelet, minikube MountVolume.SetUp succeeded for volume "default-token-2mz8l" Normal Pulled 19m kubelet, minikube Container image "docker.io/jocatalin/ kubernetes-bootcamp:v1" already present on machine Normal Created 19m kubelet, minikube Created container Normal Started 19m kubelet, minikube Started container
rolled back ## Podの⼀一覧表示 $ kubectl get pods NAME READY STATUS RESTARTS AGE kubernetes-bootcamp-6566f8f9db-5m2z4 1/1 Running 0 21m kubernetes-bootcamp-6566f8f9db-tsjrt 1/1 Running 0 36s ## デプロイされたアプリの⼀一覧表示 $ kubectl get deployments NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE kubernetes-bootcamp 2 2 2 2 1h # ロールバックに成功している