docker+k8s常用命令

K8s常用命令

kubectl get pods --namespace kube-system
kubectl get service
kubectl get svc --namespace kube-system
kubectl get pods -o wide

kubectl apply -f ~/flannel/kube-flannel.yml 创建yml文件
查看异常pod信息:
kubectl describe pods kube-flannel-ds-sr6tq -n kube-system
遇到这种情况直接 删除异常pod
kubectl delete pod kube-flannel-ds-sr6tq -n kube-system
查看pod的标签
kubectl get pods --show-labels
缩减pod的数量为2个
kubectl scale --replicas=2 deployment nginx-test
查询Pod的状态和生命周期事件:
kubectl describe pod busybox
进入Pod对应的容器内部
kubectl exec -it myweb-76h6w /bin/bash
容器打包镜像
docker save hello -o hello.tar

创建RBAC:
1.创建秘钥
2.生成CA证书
3.设置上下文
4.绑定用户到上下文
5.切换上下文
6.查看权限

docker常用命令

拉取镜像:
docker pull +镜像地址:版本号
查看镜像:
docker images
删除镜像:
docker rmi [10.18.44.208:5000/my-centos7.4]
查看正在运行的容器:
docker ps
删除docker容器:
docker rm +ID/NAME
用于查看容器的配置信息
docker inspect + ID/NAME
连接启动过的容器:
docker attach + ID
docker exec -it + ID /bin/sh
使用log参数监控容器的运行
docker logs -f NAME:版本

docker和KVM的区别
1.应用场景不同
docker是面向应用的终极目标是构建PAAS,平台即服务
kvm是面向架构的,提供一个灵活的资源池终极目标是IAAS,基础设施即服务
2.docker还是类似于进程,秒级启动,kvm类似于虚拟机,基于系统全部资源进行的隔离

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Docker is a containerization technology at the center of a new wave for building, packaging, and deploying applications. It has the potential to impact every aspect of computing, from the application development process to how applications are deployed and scaled up and out across massive data centers. Despite its great popularity, Docker is still a fairly new project, with many peo- ple still not really knowing exactly what Docker is. If you are one of those people, this book can help you take that first step, while also opening your eyes to the huge potential that containerization promises for you down the road. My goals for leading you into the world of containerization with this book can be summed up in these ways: ■ Hands-on learning: I often say this in my books, but I believe that the best way to learn how technology works is to get it and use it. To that end, I let you choose from among several popular Linux systems, show you how to install Docker on the one you choose, and provide working examples of using Docker for everything from running a simple container to building and man- aging your own container images. That learning then extends into tools and techniques for orchestrating and managing containers. ■ How Docker can benefit you: I explain the benefits of creating and run- ning applications in containers, instead of installing software packages (in formats such as RPM or Deb) and running uncontained applications directly from your hard disk. Beyond running applications, I also describe how con- tainerization can benefit software developers and system administrators. ■ Essential qualities of Docker: I describe how Docker uses technolo- gies such as Linux Containers (LXC) to keep containers separate from other applications running on a host computer or selectively tap into the host sys- tem. These qualities include how Docker uses name spaces, metadata, and separate file systems to both manage and secure containerized applications. To get started, you don’t need to know anything about Docker or containeriza- tion; you can treat this book as your introduction to Docker. However, this book is also intended to offer an entry into more advanced Docker-related topics, such as orchestration and container development. As you progress through the book, you see specific ways to run containers, investigate them, stop and start them, save them, and generally manage them. As you begin creating your own containers, I discuss techniques to help you make container images that build and run efficiently. I even step you through build files (which are called Dockerfiles) that others have created to make their own containers. A knowledge of Linux Containers in general, or Docker containers specifically, is not needed to start using this book. That said, however, there are other technolo- gies you will use both within your Docker containers and outside those containers to work with them. Understanding some of those technologies will make your expe- rience with Docker that much more fruitful.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值