quick start kubernetes

Table of Contents

写技术书籍, 特别是入门书籍, 就要象"quick start kubernetes" 这本书一样, 在一两个小时可以读完, 生动有趣, 边看边动手, 快速上手, 快速入门

学习了

  1. create and push docker image

    cd hellonode
    docker image build -t hfrtc/hellonode:1.0 .
    docker login
    docker image push hfrtc/hellonode:1.0
  2. create pod

kubectl apply -f hellonode_pod.yaml
kubectl get pods

> NAME         READY   STATUS    RESTARTS   AGE
> hello-node   1/1     Running   0          5m5s

kubectl describe pod hello-node
  1. create service
# create local service for hello-node pod
kubectl apply -f hellonode_svc.yaml
kubectl get svc
  1. cleanup
kubectl delete pod hello-node
kubectl delete svc hello-svc
  1. create deployment

$ kubectl apply -f hellonode-deploy.yaml
$ kubectl get deployments
----------------------------
NAME                READY   UP-TO-DATE   AVAILABLE   AGE
hello-node-deploy   3/3     3            3           6m30s

$ kubectl get pods
----------------------------
NAME                                 READY   STATUS    RESTARTS   AGE
hello-node-deploy-86cc5b6bcc-5kdc6   1/1     Running   0          70s
hello-node-deploy-86cc5b6bcc-99hpf   1/1     Running   0          70s
hello-node-deploy-86cc5b6bcc-sntlc   1/1     Running   0          70s

$ kubectl delete pod hello-node-deploy-86cc5b6bcc-5kdc6
pod "hello-node-deploy-86cc5b6bcc-5kdc6" deleted

$ kubectl get pods
----------------------------
NAME                                 READY   STATUS    RESTARTS   AGE
hello-node-deploy-86cc5b6bcc-99hpf   1/1     Running   0          2m17s
hello-node-deploy-86cc5b6bcc-mx8f7   1/1     Running   0          54s
hello-node-deploy-86cc5b6bcc-sntlc   1/1     Running   0          2m17s
  1. cleanup again
kubectl delete deployment hello-node-deploy

Comments |0|

Legend *) Required fields are marked
**) You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>
Category: 似水流年