当前位置: 首页 > news >正文

k8s 常用命令(四)

12删除pod中的nginx服务及service

[root@master ~]# kubectl delete deployment nginx -n kube-public

 

[root@master ~]# kubectl delete svc -n kube-public nginx-service 

 

13查看endpoint的信息

[root@master ~]# kubectl get endpoints

 

14修改/更新镜像参数......) kubectl set 

例如:查看nginx的版本号:

 

需求:修改这个运行中的nginx的版本号

[root@master ~]# kubectl set image deployment/nginx nginx=nginx:1.11

 

过程中,他会先下载新的镜像进行创建,启动后删除老版本的容器 

 

15调整副本集的数量kubectl scale

[root@master ~]# kubectl scale deployment nginx --replicas=5 -n default

deployment.apps/nginx scaled       ## -n 指定namespace,本服务就创建在默认namespace中

 

16查看详细信息kubectl describe

16.1显示所有的nodes的详细信息kubectl describe nodes

[root@master ~]# kubectl describe nodes

 

16.2查看某个node的详细信息

 [root@master ~]# kubectl describe nodes node01

Name:               node01

Roles:              node

Labels:             beta.kubernetes.io/arch=amd64

                    beta.kubernetes.io/os=linux

                    kubernetes.io/arch=amd64

                    kubernetes.io/hostname=node01

                    kubernetes.io/os=linux

                    node-role.kubernetes.io/node=node

Annotations:        flannel.alpha.coreos.com/backend-data: {"VNI":1,"VtepMAC":"c2:b4:d2:1b:fa:c2"}

                    flannel.alpha.coreos.com/backend-type: vxlan

                    flannel.alpha.coreos.com/kube-subnet-manager: true

                    flannel.alpha.coreos.com/public-ip: 192.168.159.13

                    kubeadm.alpha.kubernetes.io/cri-socket: /var/run/dockershim.sock

                    node.alpha.kubernetes.io/ttl: 0

                    volumes.kubernetes.io/controller-managed-attach-detach: true

CreationTimestamp:  Sat, 05 Nov 2022 09:26:33 +0800

Taints:             <none>

Unschedulable:      false

Lease:

  HolderIdentity:  node01

  AcquireTime:     <unset>

  RenewTime:       Sat, 05 Nov 2022 17:10:49 +0800

Conditions:

  Type                 Status  LastHeartbeatTime                 LastTransitionTime                Reason                       Message

  ----                 ------  -----------------                 ------------------                ------                       -------

  NetworkUnavailable   False   Sat, 05 Nov 2022 09:31:06 +0800   Sat, 05 Nov 2022 09:31:06 +0800   FlannelIsUp                  Flannel is running on this node

  MemoryPressure       False   Sat, 05 Nov 2022 17:07:16 +0800   Sat, 05 Nov 2022 09:26:33 +0800   KubeletHasSufficientMemory   kubelet has sufficient memory available

  DiskPressure         False   Sat, 05 Nov 2022 17:07:16 +0800   Sat, 05 Nov 2022 09:26:33 +0800   KubeletHasNoDiskPressure     kubelet has no disk pressure

  PIDPressure          False   Sat, 05 Nov 2022 17:07:16 +0800   Sat, 05 Nov 2022 09:26:33 +0800   KubeletHasSufficientPID      kubelet has sufficient PID available

  Ready                True    Sat, 05 Nov 2022 17:07:16 +0800   Sat, 05 Nov 2022 09:31:14 +0800   KubeletReady                 kubelet is posting ready status

Addresses:

  InternalIP:  192.168.159.13

  Hostname:    node01

Capacity:

  cpu:                2

  ephemeral-storage:  15349Mi

  hugepages-1Gi:      0

  hugepages-2Mi:      0

  memory:             3861508Ki

  pods:               110

Allocatable:

  cpu:                2

  ephemeral-storage:  14485133698

  hugepages-1Gi:      0

  hugepages-2Mi:      0

  memory:             3759108Ki

  pods:               110

System Info:

  Machine ID:                 737b63dadf104cdaa76db981253e1baa

  System UUID:                F0114D56-06E7-3FC5-4619-BAD443CE9F72

  Boot ID:                    ca48a336-8e26-4d35-bd9b-2f403926c2b5

  Kernel Version:             3.10.0-957.el7.x86_64

  OS Image:                   CentOS Linux 7 (Core)

  Operating System:           linux

  Architecture:               amd64

  Container Runtime Version:  docker://20.10.21

  Kubelet Version:            v1.21.3

  Kube-Proxy Version:         v1.21.3

PodCIDR:                      10.150.2.0/24

PodCIDRs:                     10.150.2.0/24

Non-terminated Pods:          (6 in total)

  Namespace                   Name                        CPU Requests  CPU Limits  Memory Requests  Memory Limits  Age

  ---------                   ----                        ------------  ----------  ---------------  -------------  ---

  default                     nginx-6fc77dcb7c-dq86p      0 (0%)        0 (0%)      0 (0%)           0 (0%)         45m

  default                     nginx-6fc77dcb7c-gv9qq      0 (0%)        0 (0%)      0 (0%)           0 (0%)         45m

  default                     nginx-6fc77dcb7c-hkcbb      0 (0%)        0 (0%)      0 (0%)           0 (0%)         49m

  kube-flannel                kube-flannel-ds-nj4vl       100m (5%)     100m (5%)   50Mi (1%)        50Mi (1%)      7h40m

  kube-system                 coredns-6f6b8cc4f6-lg6hc    100m (5%)     0 (0%)      70Mi (1%)        170Mi (4%)     7h46m

  kube-system                 kube-proxy-xd4lz            0 (0%)        0 (0%)      0 (0%)           0 (0%)         7h44m

Allocated resources:

  (Total limits may be over 100 percent, i.e., overcommitted.)

  Resource           Requests    Limits

  --------           --------    ------

  cpu                200m (10%)  100m (5%)

  memory             120Mi (3%)  220Mi (5%)

  ephemeral-storage  0 (0%)      0 (0%)

  hugepages-1Gi      0 (0%)      0 (0%)

  hugepages-2Mi      0 (0%)      0 (0%)

Events:              <none>

16.3显示所有Pod的详细信息kubectl describe pods

[root@master ~]# kubectl describe pods

 

16.4显示一个pod的详细信息 :kubectl describe deploy/nginx

[root@master ~]# kubectl describe deploy/nginx

[root@master ~]# kubectl describe deploy/nginx

Name:                   nginx

Namespace:              default

CreationTimestamp:      Sat, 05 Nov 2022 16:06:47 +0800

Labels:                 app=nginx

Annotations:            deployment.kubernetes.io/revision: 3

Selector:               app=nginx

Replicas:               5 desired | 5 updated | 5 total | 5 available | 0 unavailable

StrategyType:           RollingUpdate

MinReadySeconds:        0

RollingUpdateStrategy:  25% max unavailable, 25% max surge

Pod Template:

  Labels:  app=nginx

  Containers:

   nginx:

    Image:        nginx:1.21

    Port:         80/TCP

    Host Port:    0/TCP

    Environment:  <none>

    Mounts:       <none>

  Volumes:        <none>

Conditions:

  Type           Status  Reason

  ----           ------  ------

  Progressing    True    NewReplicaSetAvailable

  Available      True    MinimumReplicasAvailable

OldReplicaSets:  <none>

NewReplicaSet:   nginx-6fc77dcb7c (5/5 replicas created)

Events:

  Type    Reason             Age                From                   Message

  ----    ------             ----               ----                   -------

  Normal  ScalingReplicaSet  56m                deployment-controller  Scaled up replica set nginx-6fc77dcb7c to 1

  Normal  ScalingReplicaSet  56m                deployment-controller  Scaled down replica set nginx-897f8f586 to 2

  Normal  ScalingReplicaSet  52m (x5 over 56m)  deployment-controller  (combined from similar events): Scaled up replica set nginx-6fc77dcb7c to 5

16.5显示所有svc详细信息kubectl describe svc

[root@master ~]# kubectl describe svc

[root@master ~]# kubectl describe svc

Name:              kubernetes

Namespace:         default

Labels:            component=apiserver

                   provider=kubernetes

Annotations:       <none>

Selector:          <none>

Type:              ClusterIP

IP Family Policy:  SingleStack

IP Families:       IPv4

IP:                10.125.0.1

IPs:               10.125.0.1

Port:              https  443/TCP

TargetPort:        6443/TCP

Endpoints:         192.168.159.12:6443

Session Affinity:  None

Events:            <none>

Name:                     nginx-service

Namespace:                default

Labels:                   app=nginx

Annotations:              <none>

Selector:                 app=nginx

Type:                     NodePort

IP Family Policy:         SingleStack

IP Families:              IPv4

IP:                       10.125.204.159

IPs:                      10.125.204.159

Port:                     <unset>  80/TCP

TargetPort:               80/TCP

NodePort:                 <unset>  30307/TCP

Endpoints:                10.150.1.10:80,10.150.1.11:80,10.150.2.11:80 + 2 more...

Session Affinity:         None

External Traffic Policy:  Cluster

Events:                   <none>

16.6显示指定svc的详细信息kubectl describe svc nginx-service

[root@master ~]# kubectl describe svc nginx-service

[root@master ~]# kubectl describe svc nginx-service

Name:                     nginx-service

Namespace:                default

Labels:                   app=nginx

Annotations:              <none>

Selector:                 app=nginx

Type:                     NodePort

IP Family Policy:         SingleStack

IP Families:              IPv4

IP:                       10.125.204.159

IPs:                      10.125.204.159

Port:                     <unset>  80/TCP

TargetPort:               80/TCP

NodePort:                 <unset>  30307/TCP

Endpoints:                10.150.1.10:80,10.150.1.11:80,10.150.2.11:80 + 2 more...

Session Affinity:         None

External Traffic Policy:  Cluster

Events:                   <none>

16.7显示所有namespace的详细信息kubectl describe ns

[root@master ~]# kubectl describe ns

[root@master ~]# kubectl describe ns

Name:         ceshi

Labels:       kubernetes.io/metadata.name=ceshi

Annotations:  <none>

Status:       Active

No resource quota.

No LimitRange resource.

Name:         default

Labels:       kubernetes.io/metadata.name=default

Annotations:  <none>

Status:       Active

No resource quota.

No LimitRange resource.

Name:         kube-flannel

Labels:       kubernetes.io/metadata.name=kube-flannel

              pod-security.kubernetes.io/enforce=privileged

Annotations:  <none>

Status:       Active

No resource quota.

No LimitRange resource.

Name:         kube-node-lease

Labels:       kubernetes.io/metadata.name=kube-node-lease

Annotations:  <none>

Status:       Active

No resource quota.

No LimitRange resource.

Name:         kube-public

Labels:       kubernetes.io/metadata.name=kube-public

Annotations:  <none>

Status:       Active

No resource quota.

No LimitRange resource.

Name:         kube-system

Labels:       kubernetes.io/metadata.name=kube-system

Annotations:  <none>

Status:       Active

No resource quota.

No LimitRange resource.

16.8显示指定namespace的详细信息kubectl describe ns kube-public

[root@master ~]# kubectl describe ns kube-public

[root@master ~]# kubectl describe ns public

Error from server (NotFound): namespaces "public" not found

[root@master ~]# kubectl describe ns kube-public

Name:         kube-public

Labels:       kubernetes.io/metadata.name=kube-public

Annotations:  <none>

Status:       Active

No resource quota.

No LimitRange resource.

故障现象:节点3node 1master1、现在创建一个pod,发现结果是pod无法创建

kubectl describe po pod_name-n namespaces

events:

调度器正常完成工作正常退出pod 创建失败,可能原因之一:资源现在问题

 

相关文章:

k8s 常用命令(四)

12、删除pod中的nginx服务及service [rootmaster ~]# kubectl delete deployment nginx -n kube-public [rootmaster ~]# kubectl delete svc -n kube-public nginx-service 13、查看endpoint的信息 [rootmaster ~]# kubectl get endpoints 14、修改/更新&#xff08;镜像、…...

大语言模型的分布式训练

什么是大语言模型 大语言模型(Large Language Model,缩写LLM),也称大型语言模型,是一种人工智能模型,旨在理解和生成人类语言。它们在大量的文本数据上进行训练,可以执行广泛的任务,包括文本总结、翻译、情感分析等等。LLM的特点是规模庞大,包含数十亿的参数,帮助它们学习语言…...

【JavaEE】Spring全家桶实现AOP-统一处理

【JavaEE】AOP&#xff08;2&#xff09; 文章目录 【JavaEE】AOP&#xff08;2&#xff09;1. 统一登录校验处理1.1 自定义拦截器1.2 将自定义拦截器加入到系统配置1.3 测试1.4 对于静态资源的处理1.5 小练习&#xff1a;统一登录拦截处理1.6 拦截器原理1.6.1 执行流程1.6.2 源…...

HQL解决连续三天登陆问题

1.背景 统计连续登录天数超过3天的用户&#xff0c;输出信息包括&#xff1a;用户id&#xff0c;登录天数&#xff0c;起始时间&#xff0c;结束时间&#xff1b; 2.准备数据 -- 建表 create table if not exists user_login_3days(user_id STRING,login_date date );--插入…...

(一)Docker简介(一篇足以)

一、简介 一个项目环境配置相当麻烦&#xff0c;如果换一台机器跑起来&#xff0c;所有配置就要重来一次&#xff0c;费力费时。很多人想到&#xff0c;能不能从根本上解决问题&#xff0c;软件可以带环境安装&#xff1f;也就是说&#xff0c;安装的时候&#xff0c;把原始环…...

RK3568 安卓源码编译

一.repo安卓编译工具 项目模块化/组件化之后各模块也作为独立的 Git 仓库从主项目里剥离了出去&#xff0c;各模块各自管理自己的版本。Android源码引用了很多开源项目&#xff0c;每一个子项目都是一个Git仓库&#xff0c;每个Git仓库都有很多分支版本&#xff0c;为了方便统…...

第4篇:vscode+platformio搭建esp32 arduino开发环境

第1篇:Arduino与ESP32开发板的安装方法 第2篇:ESP32 helloword第一个程序示范点亮板载LED 第3篇:vscode搭建esp32 arduino开发环境 1.配置默认安装路径&#xff0c;安装到D盘。 打开环境变量&#xff0c;点击新建 输入变量名PLATFORMIO_CORE_DIR与路径&#xff1a;D:\PLATF…...

2023前端面试笔记 —— CSS3

系列文章目录 内容链接2023前端面试笔记HTML52023前端面试笔记CSS3 文章目录 系列文章目录前言一、CSS选择器的优先级二、通过 CSS 的哪些方式可以实现隐藏页面上的元素三、px、em、rem之间有什么区别&#xff1f;四、让元素水平居中的方法有哪些五、在 CSS 中有哪些定位方式六…...

iOS 如何对整张图分别局部磨砂,并完全贴合

官方磨砂方式 - (UIVisualEffectView *)effectView{if(!_effectView){UIBlurEffect *blur [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];_effectView [[UIVisualEffectView alloc] initWithEffect:blur];}return _effectView; }使用这种方式对一张图的上半部分和…...

Packet_Tracer的使用

一、实验目的&#xff1a; 通过该实验了解Packet Tracer的使用方法&#xff0c;能够用Packet Tracer建立和模拟网络模型。 二、主要任务&#xff1a; 1.熟悉PT的界面&#xff0c;了解按键用途。 2.尝试自己建立一个小型网络&#xff0c;并测试连通性。 3.学习P…...

WPF如果未定义绑定的属性,程序如何处理

问题&#xff1a;wpf中&#xff0c;<Button IsEnabled"{Binding IsValid1}"></Button>&#xff0c;如果没定义绑定的属性IsValid1&#xff0c;可以正常用吗 解答&#xff1a;在 WPF 中&#xff0c;如果没有定义绑定的属性 IsValid1&#xff0c;会导致绑…...

韩国留学生生活之-租房篇,柯桥韩语培训留学韩语需要学到什么程度

对于计划在韩国留学的人来说&#xff0c;找到合适的租房是一个重要而且有挑战性的任务。 留学生遇到的常见租房类型为月付型、全税房。月付型就是我们常见的租房方式&#xff0c;一般都需要支付一个月或数个月月租的押金&#xff0c;按时间付房租即可&#xff0c;租期通常为一…...

论文笔记:基于概念漂移的在线类非平衡学习系统研究

0 摘要 论文&#xff1a;A Systematic Study of Online Class Imbalance Learning With Concept Drift 发表&#xff1a;2018年发表在TNNLS上 源代码&#xff1a;&#xff1f; 作为一个新兴的研究课题&#xff0c;在线类非平衡学习往往结合了类非平衡和概念漂移的挑战。它处理…...

ubuntu22.04下rv1109 rootfs编译问题处理

ubuntu22.04下rv1109 rootfs编译问题处理 buildroot编译出错记录问题一&#xff1a;c-stack.c的SIGSTKSZ错误解决办法问题二&#xff1a;libfakeroot.c的_STAT_VER报错解决办法问题三&#xff1a;fwriter_buffer重复定义解决办法问题四&#xff1a; qfloat16.h报错解决办法问题…...

Spring Boot Dubbo Zookeeper

文章目录 Spring Boot Dubbo Zookeeper简介DubboCommonProviderConsumer Zookeeper Spring Boot Dubbo Zookeeper 简介 Dubbo Common 公共依赖 <!-- Spring Boot Starter --> <dependency><groupId>org.springframework.boot</groupId><artifac…...

线程池的概念及实现原理

本篇是对前面线程池具体实现过程的补充&#xff0c;实现过程可参考 线程池的实现全过程v1.0版本&#xff08;手把手创建&#xff0c;看完必掌握&#xff01;&#xff01;&#xff01;&#xff09;_竹烟淮雨的博客-CSDN博客 线程池的实现v2.0&#xff08;可伸缩线程池&#xf…...

iOS App逆向之:iOS应用砸壳技术

在iOS逆向&#xff0c;有一项关键的技术叫做“iOS砸壳”&#xff08;iOS App Decryption&#xff09;。自iOS 5版本以来&#xff0c;苹果引入了应用程序加密机制&#xff0c;使得大部分应用都需要进行砸壳操作才能进行逆向分析。因此作为开发者、逆向工程师和安全研究人员都需要…...

【高性能计算】opencl安装及相关概念

目录 从异构计算讲起opencl安装的相关说明查看linux系统cpu及gpu型号方法安装opencl helloword程序运行 从异构计算讲起 异构计算是一种利用多种不同类型的计算资源来协同解决计算问题的方法。它的核心思想是将不同特性和能力的计算设备&#xff08;例如CPU、GPU、FPGA等&…...

盛最多水的容器——力扣11

int maxArea(vector<int>& height) {int l=0, r=height.size()...

2023年高教社杯数学建模思路 - 复盘:校园消费行为分析

文章目录 0 赛题思路1 赛题背景2 分析目标3 数据说明4 数据预处理5 数据分析5.1 食堂就餐行为分析5.2 学生消费行为分析 建模资料 0 赛题思路 &#xff08;赛题出来以后第一时间在CSDN分享&#xff09; https://blog.csdn.net/dc_sinor?typeblog 1 赛题背景 校园一卡通是集…...

stm32G473的flash模式是单bank还是双bank?

今天突然有人stm32G473的flash模式是单bank还是双bank&#xff1f;由于时间太久&#xff0c;我真忘记了。搜搜发现&#xff0c;还真有人和我一样。见下面的链接&#xff1a;https://shequ.stmicroelectronics.cn/forum.php?modviewthread&tid644563 根据STM32G4系列参考手…...

智慧工地云平台源码,基于微服务架构+Java+Spring Cloud +UniApp +MySql

智慧工地管理云平台系统&#xff0c;智慧工地全套源码&#xff0c;java版智慧工地源码&#xff0c;支持PC端、大屏端、移动端。 智慧工地聚焦建筑行业的市场需求&#xff0c;提供“平台网络终端”的整体解决方案&#xff0c;提供劳务管理、视频管理、智能监测、绿色施工、安全管…...

[10-3]软件I2C读写MPU6050 江协科技学习笔记(16个知识点)

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16...

自然语言处理——Transformer

自然语言处理——Transformer 自注意力机制多头注意力机制Transformer 虽然循环神经网络可以对具有序列特性的数据非常有效&#xff0c;它能挖掘数据中的时序信息以及语义信息&#xff0c;但是它有一个很大的缺陷——很难并行化。 我们可以考虑用CNN来替代RNN&#xff0c;但是…...

【论文阅读28】-CNN-BiLSTM-Attention-(2024)

本文把滑坡位移序列拆开、筛优质因子&#xff0c;再用 CNN-BiLSTM-Attention 来动态预测每个子序列&#xff0c;最后重构出总位移&#xff0c;预测效果超越传统模型。 文章目录 1 引言2 方法2.1 位移时间序列加性模型2.2 变分模态分解 (VMD) 具体步骤2.3.1 样本熵&#xff08;S…...

OpenLayers 分屏对比(地图联动)

注&#xff1a;当前使用的是 ol 5.3.0 版本&#xff0c;天地图使用的key请到天地图官网申请&#xff0c;并替换为自己的key 地图分屏对比在WebGIS开发中是很常见的功能&#xff0c;和卷帘图层不一样的是&#xff0c;分屏对比是在各个地图中添加相同或者不同的图层进行对比查看。…...

力扣-35.搜索插入位置

题目描述 给定一个排序数组和一个目标值&#xff0c;在数组中找到目标值&#xff0c;并返回其索引。如果目标值不存在于数组中&#xff0c;返回它将会被按顺序插入的位置。 请必须使用时间复杂度为 O(log n) 的算法。 class Solution {public int searchInsert(int[] nums, …...

Python 包管理器 uv 介绍

Python 包管理器 uv 全面介绍 uv 是由 Astral&#xff08;热门工具 Ruff 的开发者&#xff09;推出的下一代高性能 Python 包管理器和构建工具&#xff0c;用 Rust 编写。它旨在解决传统工具&#xff08;如 pip、virtualenv、pip-tools&#xff09;的性能瓶颈&#xff0c;同时…...

【前端异常】JavaScript错误处理:分析 Uncaught (in promise) error

在前端开发中&#xff0c;JavaScript 异常是不可避免的。随着现代前端应用越来越多地使用异步操作&#xff08;如 Promise、async/await 等&#xff09;&#xff0c;开发者常常会遇到 Uncaught (in promise) error 错误。这个错误是由于未正确处理 Promise 的拒绝&#xff08;r…...

书籍“之“字形打印矩阵(8)0609

题目 给定一个矩阵matrix&#xff0c;按照"之"字形的方式打印这个矩阵&#xff0c;例如&#xff1a; 1 2 3 4 5 6 7 8 9 10 11 12 ”之“字形打印的结果为&#xff1a;1&#xff0c;…...