惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
L
LINUX DO - 最新话题
Recorded Future
Recorded Future
月光博客
月光博客
博客园 - 【当耐特】
博客园 - 叶小钗
宝玉的分享
宝玉的分享
量子位
雷峰网
雷峰网
博客园 - 三生石上(FineUI控件)
The Cloudflare Blog
Vercel News
Vercel News
L
LangChain Blog
B
Blog
Y
Y Combinator Blog
爱范儿
爱范儿
GbyAI
GbyAI
S
Security @ Cisco Blogs
T
The Blog of Author Tim Ferriss
A
About on SuperTechFans
博客园 - Franky
P
Palo Alto Networks Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
云风的 BLOG
云风的 BLOG
C
Cisco Blogs
Scott Helme
Scott Helme
I
Intezer
T
The Exploit Database - CXSecurity.com
MyScale Blog
MyScale Blog
T
Tor Project blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
T
Troy Hunt's Blog
N
News and Events Feed by Topic
大猫的无限游戏
大猫的无限游戏
F
Fortinet All Blogs
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
S
Security Affairs
Cyberwarzone
Cyberwarzone
PCI Perspectives
PCI Perspectives
小众软件
小众软件
D
DataBreaches.Net
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Know Your Adversary
Know Your Adversary
Forbes - Security
Forbes - Security
S
Securelist
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
C
Cyber Attacks, Cyber Crime and Cyber Security
The Last Watchdog
The Last Watchdog

博客园 - lswweb

Drone概念与答疑 Drone基于K8S的Secrets管理 Centos8通过X11使用GUI应用 Linux自己常用命令记录(待续) K8S Master节点灾备与恢复 - ETCD K8S Master节点灾备与恢复 - Host文件Copy Rook Ceph出现daemons have recently crashed异常 Ceph rbd删除image遭遇watchers异常处理 Ceph OSD更换硬盘后遭遇PG Inconsistent异常与处理 Rook Ceph OSD异常,格式化osd硬盘重新挂载 K8S Pod挂载rook ceph pv报not found in the list of registered CSI drivers异常处理 Vs中调试MVC源代码步骤 手动创建vsct文件 快速查找找VS菜单信息(Guid、GuidId、CmdId等) 在多排序条件下SQL获文章上一条、下一条记录 Knockout中ViewModel与Model的互转 Asp.Net MVC 表单验证 AjaxOptions.OnSuccess回调方法返回的参数信息 一次自定义Configuration的悲惨经历。
进入K8S Pod执行操作,遭遇Operation not permitted错误
lswweb · 2020-10-27 · via 博客园 - lswweb

前置需求

  • POD 名称ks-installer-58b9cf7c4c-qtgrn
  • 进入Pod修改/etc/resolv.conf文件权限(文件原为只读)

遭遇问题

1、通过k8s exec命令进入pod

kubectl exec -it ks-installer-58b9cf7c4c-qtgrn -n kubesphere-system /bin/bash

2、修改resolv.conf文件权限,提示

chmod 666 /etc/resolv.conf
chmod: /etc/resolv.conf: Operation not permitted

解决方法

         通过K8S EXEC进入Pod的用户是普通用户,而修改文件我们需要root权限。K8S EXEC命令目前没有找到指定用户的相关参数,但是Docker的EXEC命令可以通过-u指定root用户,那么可以通过docker命令进入Pod进行操作。

1、查询Pod的Docker容器Id

kubectl describe pod ks-installer-58b9cf7c4c-qtgrn -n kubesphere-system

image

2、通过docker exec 用管理员权限进入容器

docker exec -u root 1a0dfe3d4c75f30512a14756f63a200226aff2b157b0fdfa80e14f455cb40e69 -/bin/bash

注意:要注意pod是被k8s调度到那个节点上边,需要在对应的节点上执行docker命令

3、修改resolv.conf文件权限