博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
k8s cookbook读书笔记 第二章
阅读量:4672 次
发布时间:2019-06-09

本文共 1641 字,大约阅读时间需要 5 分钟。

走一遍概念  

  • An overview of Kubernetes control
  • f Working with pods
  • f Working with a replication controller
  • f Working with services
  • f Working with volumes
  • f Working with secrets
  • f Working with names
  • f Working with namespaces
  • f Working with labels and selectors

 

  1. An overview of Kubernetes control

查看k8s版本

  % kubectl version

是如何做到的

  kubectl通过restful api 连接kubernetes api server

如何工作的

  kubectl [command] [TYPE] [NAME] [flags]

      /usr/local/bin/kubectl run my-first-nginx --image=nginx

      However, you can write either a YAML file or a JSON file to perform similar operations. 

# cat nginx.yamlapiVersion: v1kind: ReplicationControllermetadata:name: my-first-nginxspec:replicas: 1template:metadata:labels:app: nginxspec:containers:- name: my-first-nginximage: nginx

Then specify the  create -f option to execute the  kubectl command as follows

# kubectl create -f nginx.yamlreplicationcontroller "my-first-nginx" created

 status of the replication controller

# kubectl get replicationcontrollersCONTROLLER CONTAINER(S) IMAGE(S) SELECTOR REPLICAS AGEmy-first-nginx my-first-nginx nginx app=nginx 1 12s

 缩写

kubectl get rcCONTROLLER CONTAINER(S) IMAGE(S) SELECTOR REPLICAS AGEmy-first-nginx my-first-nginx nginx app=nginx 1 1m

删除

# kubectl delete rc my-first-nginxreplicationcontroller "my-first-nginx" deleted

2.pods

   是k8s中最小的可部署单元

   每个pod被进程id,网络,进程间通信,时间命名空间隔离。

docker pull centos
# cat my-first-pod.yamlapiVersion: v1kind: Podmetadata:name: my-first-podspec:containers:- name: my-nginximage: nginx- name: my-centosimage: centoscommand: ["/bin/sh", "-c", "while : ;do curl http://localhost:80/; sleep 3; done"]

 

   

 

转载于:https://www.cnblogs.com/guxiaobei/p/8065085.html

你可能感兴趣的文章
Git Day02,工作区,暂存区,回退,删除文件
查看>>
Windows Phone 7 Coding4Fun控件简介
查看>>
Nginx 常用命令总结
查看>>
hall wrong behavior
查看>>
Markdown test
查看>>
Collection集合
查看>>
int最大值+1为什么是-2147483648最小值-1为什么是2147483647
查看>>
【C++】const在不同位置修饰指针变量
查看>>
github新项目挂历模式
查看>>
编写jquery插件
查看>>
敏捷开发笔记
查看>>
神秘海域:顶级工作室“顽皮狗”成长史(下)
查看>>
C++指针、引用知多少?
查看>>
services 系统服务的启动、停止、卸载
查看>>
Fiddler 网页采集抓包利器__手机app抓包
查看>>
Number and String
查看>>
java中的值传递和引用传递2<原文:http://blog.csdn.net/niuniu20008/article/details/2953785>...
查看>>
css实现背景图片模糊
查看>>
什么是runtime?什么是webgl?
查看>>
秋季学习总结
查看>>