docker管理神器—kubernetes—pod篇

來源:互聯網
上載者:User

標籤:docker管理神器—kubernetes—pod篇

前面介紹了pod是個容器組,那麼現在就來建立一個pod,就像dockerfile一樣。

vi nginx-pod.yaml(要十分注意空格,一般為兩個空格)

添加:

apiVersion: v1

kind: Pod

metadata:

  name: nginx1

spec:

  containers:

  - name: nginx1

    image: docker.io/nginx

    ports:

    - containerPort: 9001

啟動Pod

kubectl create -f nginx-pod.yaml

使用get pods查看

650) this.width=650;" src="http://s4.51cto.com/wyfs02/M01/88/89/wKioL1f7Tn_RJAOUAAAQwjCNxUA018.png" title="817cc777-d671-4aee-b74b-ca8300524af7.png" alt="wKioL1f7Tn_RJAOUAAAQwjCNxUA018.png" />

 kubectl describe pods nginx

650) this.width=650;" src="http://s2.51cto.com/wyfs02/M00/88/8D/wKiom1f7TtXTygtCAABSVHdnr4Y286.png" title="c4a5a133-d8be-415a-8814-ba65dd8ae4ce.png" alt="wKiom1f7TtXTygtCAABSVHdnr4Y286.png" />

 在minion端查看: 

docker ps(它會首先啟動一個pod-infrastructure容器,然後在本機找是否有nginx鏡像,沒有就去下載)

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/88/89/wKioL1f7T5iB_nfqAABcz7uewhg554.png" title="2162c3c2-4073-43cb-b26a-66050973b254.png" alt="wKioL1f7T5iB_nfqAABcz7uewhg554.png" />

更多具體的詳細的關於pod與yaml的編寫和建立建議去google上查閱資料。




本文出自 “Linux” 部落格,請務必保留此出處http://syklinux.blog.51cto.com/9631548/1860292

docker管理神器—kubernetes—pod篇

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.