1. Create and run a Pod

kubectl run my-nginx --image=nginx:alpine

We can run

kubectl get all

to see what has been created:

2. Delete a Pod:

kubectl delete pod my-nginx-65959bc4b9-dfvwh

Then run:

kubectl get pods

I found a new pod get created.

my-nginx-65959bc4b9-ltvxs

3. This is because the 'deployment' is trying to keep the current state, if I have one pod, and 'deploment' trying to keep one pod alive: which means if I deleted one, 'deployment' will create a new pod. After's why you see another pod pop up.

4. But this point, we have one pod, but we cannot access it.

There is nothing in http://localhost:8080/

That's becaue we don't forward the port to external world. To do it:

kubectl port-forward my-nginx-65959bc4b9-ltvxs 8080:80

After that we can see the welcome page from nginx.

5. So actually how to delete a pod? Actually, if you want to delete a Pod,  you should delete the whole 'deployment;:

kubectl delete deployment my-nginx

6. We can check again:

kubectl get pods
// No resources found.

[Kubernetes] Kubectl and Pod的更多相关文章

  1. kubernetes系列07—Pod控制器详解

    本文收录在容器技术学习系列文章总目录 1.Pod控制器 1.1 介绍 Pod控制器是用于实现管理pod的中间层,确保pod资源符合预期的状态,pod的资源出现故障时,会尝试 进行重启,当根据重启策略无 ...

  2. Kubernetes — 深入解析Pod对象:基本概念(二)

    作为 Kubernetes 项目里最核心的编排对象,Pod 携带的信息非常丰富.其中,资源定义(比如 CPU.内存等),以及调度相关的字段.在本篇,我们就先从一种特殊的 Volume 开始,来帮助你更 ...

  3. Docker Kubernetes 创建管理 Pod

    Docker Kubernetes 容器扩容与缩容 环境: 系统:Centos 7.4 x64 Docker版本:18.09.0 Kubernetes版本:v1.8 管理节点:192.168.1.79 ...

  4. Kubernetes基础:Pod的详细介绍

    本文的演练环境为基于Virtualbox搭建的Kubernetes集群,具体搭建步骤可以参考kubeadm安装kubernetes V1.11.1 集群 1. 基本概念 1.1 Pod是什么 Pod是 ...

  5. Kubernetes kubectl 命令

    kubectl 命令用来操作 Kubernetes 集群中的资源对象,包括对资源的创建.删除.查看.修改.配置.运行等 命令语法:kubectl [command] [TYPE] [NAME] [fl ...

  6. Kubernetes 无法删除pod实例的排查过程

    今天在k8s集群创建pod时,执行了如下命令: #kubectl run busybox-service --image=busybox --replicas=3 但是在创建过程中pod既然失败了, ...

  7. kubernetes 无法删除 pod 问题的解决

    [摘要] kubernetes 可能会产生垃圾或者僵尸pod,在删除rc的时候,相应的pod没有被删除,手动删除pod后会自动重新创建,这时一般需要先删除掉相关联的resources,实际中还要具体情 ...

  8. Kubernetes对象之Pod

    系列目录 Pod是Kubernetes调度的最小单元.一个Pod可以包含一个或多个容器,因此它可以被看作是内部容器的逻辑宿主机.Pod的设计理念是为了支持多个容器在一个Pod中共享网络和文件系统 因此 ...

  9. kubernetes高级之pod安全策略

    系列目录 什么是pod安全策略 pod安全策略是集群级别的用于控制pod安全相关选项的一种资源.PodSecurityPolicy定义了一系列pod相要进行在系统中必须满足的约束条件,以衣一些默认的约 ...

随机推荐

  1. python函数知识五 推导式和内置函数一(了解)

    17.推导式: 推导式:将for循环多行变成一行 list推导式:[] #普通模式 print([i for i in range(20)]) #循环模式 #[变量 for i in range(20 ...

  2. -Dmaven.test.skip=true 和 -DskipTests

    -DskipTests,不执行测试用例,但编译测试用例类生成相应的class文件至target/test-classes下. -Dmaven.test.skip=true,不执行测试用例,也不编译测试 ...

  3. 温故知新-网络基础1-ip地址计算

    网络地址换算 1.网络地址分类 A类:0.0.0.0到127.255.255.255 255.0.0.0/8 B类:128.0.0.0到191.255.255.255 255.255.0.0/16 C ...

  4. 爬虫 HttpHelper

    /// <summary> /// 类说明:HttpHelper类,用来实现Http访问,Post或者Get方式的,直接访问,带Cookie的,带证书的等方式,可以设置代理 /// 重要提 ...

  5. power shell导出文件夹目录递归

    --获取目录:Get-ChildItem --递归目录:-Recurse --选择想要导出的目录参数,如:文件名,时间,权限等:Select-Object Name, LastWriteTime, M ...

  6. e.preventDefault()与e.stopPropagation()的区别

    e.stopPropagation()阻止事件冒泡<table border='1'> <tr> <td><span>冒泡事件测试</span&g ...

  7. OS UIButton之UIButtonType详解-转

    我做了一个关于UIButtonType的Demo,效果如下图: UIButtonType各个类型的解释: typedef NS_ENUM(NSInteger, UIButtonType) { UIBu ...

  8. thinkphp概述2

    thinkphp概述,thinkphp项目构建流程,thinkphp项目结构,thinkphp配置,thinkphp控制器,thinkphp模型,thinkphp视图,thinkphp的内置模板引擎. ...

  9. USB之基本协议和数据波形1

    =============  本系列参考  ============= <圈圈教你玩USB>.<Linux那些事儿之我是USB> 协议文档:https://www.usb.or ...

  10. PHP-5.6.8 源码包编译安装

    一.下载源码包后,进行解压 [root@www home]# .tar.bz2 gzip: stdin: not in gzip format tar: Error is not recoverabl ...