[kubernetes]-weave scope初体验

小灰灰 2022-12-04 01:29 236阅读 0赞

获取yaml

  1. curl https://cloud.weave.works/k8s/scope.yaml?k8s-version=$(kubectl version | base64 | tr -d '\n') > init.yaml
  2. apiVersion: v1
  3. kind: List
  4. items:
  5. - apiVersion: v1
  6. kind: Namespace
  7. metadata:
  8. name: weave
  9. annotations:
  10. cloud.weave.works/version: v1.0.0-282-g0d7359d
  11. - apiVersion: v1
  12. kind: ServiceAccount
  13. metadata:
  14. name: weave-scope
  15. annotations:
  16. cloud.weave.works/launcher-info: |-
  17. {
  18. "original-request": {
  19. "url": "/k8s/scope.yaml?k8s-version=Q2xpZW50IFZlcnNpb246IHZlcnNpb24uSW5mb3tNYWpvcjoiMSIsIE1pbm9yOiIxNCIsIEdpdFZlcnNpb246InYxLjE0LjIiLCBHaXRDb21taXQ6IjY2MDQ5ZTNiMjFlZmUxMTA0NTRkNjdkZjRmYTYyYjA4ZWE3OWExOWIiLCBHaXRUcmVlU3RhdGU6ImNsZWFuIiwgQnVpbGREYXRlOiIyMDE5LTA1LTE2VDE2OjIzOjA5WiIsIEdvVmVyc2lvbjoiZ28xLjEyLjUiLCBDb21waWxlcjoiZ2MiLCBQbGF0Zm9ybToibGludXgvYW1kNjQifQpTZXJ2ZXIgVmVyc2lvbjogdmVyc2lvbi5JbmZve01ham9yOiIxIiwgTWlub3I6IjE0IiwgR2l0VmVyc2lvbjoidjEuMTQuMiIsIEdpdENvbW1pdDoiNjYwNDllM2IyMWVmZTExMDQ1NGQ2N2RmNGZhNjJiMDhlYTc5YTE5YiIsIEdpdFRyZWVTdGF0ZToiY2xlYW4iLCBCdWlsZERhdGU6IjIwMTktMDUtMTZUMTY6MTQ6NTZaIiwgR29WZXJzaW9uOiJnbzEuMTIuNSIsIENvbXBpbGVyOiJnYyIsIFBsYXRmb3JtOiJsaW51eC9hbWQ2NCJ9Cg==",
  20. "date": "Thu Sep 03 2020 07:36:04 GMT+0000 (UTC)"
  21. },
  22. "email-address": "support@weave.works"
  23. }
  24. labels:
  25. name: weave-scope
  26. namespace: weave
  27. - apiVersion: rbac.authorization.k8s.io/v1
  28. kind: ClusterRole
  29. metadata:
  30. name: weave-scope
  31. annotations:
  32. cloud.weave.works/launcher-info: |-
  33. {
  34. "original-request": {
  35. "url": "/k8s/scope.yaml?k8s-version=Q2xpZW50IFZlcnNpb246IHZlcnNpb24uSW5mb3tNYWpvcjoiMSIsIE1pbm9yOiIxNCIsIEdpdFZlcnNpb246InYxLjE0LjIiLCBHaXRDb21taXQ6IjY2MDQ5ZTNiMjFlZmUxMTA0NTRkNjdkZjRmYTYyYjA4ZWE3OWExOWIiLCBHaXRUcmVlU3RhdGU6ImNsZWFuIiwgQnVpbGREYXRlOiIyMDE5LTA1LTE2VDE2OjIzOjA5WiIsIEdvVmVyc2lvbjoiZ28xLjEyLjUiLCBDb21waWxlcjoiZ2MiLCBQbGF0Zm9ybToibGludXgvYW1kNjQifQpTZXJ2ZXIgVmVyc2lvbjogdmVyc2lvbi5JbmZve01ham9yOiIxIiwgTWlub3I6IjE0IiwgR2l0VmVyc2lvbjoidjEuMTQuMiIsIEdpdENvbW1pdDoiNjYwNDllM2IyMWVmZTExMDQ1NGQ2N2RmNGZhNjJiMDhlYTc5YTE5YiIsIEdpdFRyZWVTdGF0ZToiY2xlYW4iLCBCdWlsZERhdGU6IjIwMTktMDUtMTZUMTY6MTQ6NTZaIiwgR29WZXJzaW9uOiJnbzEuMTIuNSIsIENvbXBpbGVyOiJnYyIsIFBsYXRmb3JtOiJsaW51eC9hbWQ2NCJ9Cg==",
  36. "date": "Thu Sep 03 2020 07:36:04 GMT+0000 (UTC)"
  37. },
  38. "email-address": "support@weave.works"
  39. }
  40. labels:
  41. name: weave-scope
  42. rules:
  43. - apiGroups:
  44. - ''
  45. resources:
  46. - pods
  47. verbs:
  48. - get
  49. - list
  50. - watch
  51. - delete
  52. - apiGroups:
  53. - ''
  54. resources:
  55. - pods/log
  56. - services
  57. - nodes
  58. - namespaces
  59. - persistentvolumes
  60. - persistentvolumeclaims
  61. verbs:
  62. - get
  63. - list
  64. - watch
  65. - apiGroups:
  66. - apps
  67. resources:
  68. - deployments
  69. - daemonsets
  70. - statefulsets
  71. verbs:
  72. - get
  73. - list
  74. - watch
  75. - apiGroups:
  76. - batch
  77. resources:
  78. - cronjobs
  79. - jobs
  80. verbs:
  81. - get
  82. - list
  83. - watch
  84. - apiGroups:
  85. - extensions
  86. resources:
  87. - deployments
  88. - daemonsets
  89. verbs:
  90. - get
  91. - list
  92. - watch
  93. - apiGroups:
  94. - apps
  95. resources:
  96. - deployments/scale
  97. verbs:
  98. - get
  99. - update
  100. - apiGroups:
  101. - extensions
  102. resources:
  103. - deployments/scale
  104. verbs:
  105. - get
  106. - update
  107. - apiGroups:
  108. - storage.k8s.io
  109. resources:
  110. - storageclasses
  111. verbs:
  112. - get
  113. - list
  114. - watch
  115. - apiGroups:
  116. - volumesnapshot.external-storage.k8s.io
  117. resources:
  118. - volumesnapshots
  119. - volumesnapshotdatas
  120. verbs:
  121. - list
  122. - watch
  123. - apiVersion: rbac.authorization.k8s.io/v1
  124. kind: ClusterRoleBinding
  125. metadata:
  126. name: weave-scope
  127. annotations:
  128. cloud.weave.works/launcher-info: |-
  129. {
  130. "original-request": {
  131. "url": "/k8s/scope.yaml?k8s-version=Q2xpZW50IFZlcnNpb246IHZlcnNpb24uSW5mb3tNYWpvcjoiMSIsIE1pbm9yOiIxNCIsIEdpdFZlcnNpb246InYxLjE0LjIiLCBHaXRDb21taXQ6IjY2MDQ5ZTNiMjFlZmUxMTA0NTRkNjdkZjRmYTYyYjA4ZWE3OWExOWIiLCBHaXRUcmVlU3RhdGU6ImNsZWFuIiwgQnVpbGREYXRlOiIyMDE5LTA1LTE2VDE2OjIzOjA5WiIsIEdvVmVyc2lvbjoiZ28xLjEyLjUiLCBDb21waWxlcjoiZ2MiLCBQbGF0Zm9ybToibGludXgvYW1kNjQifQpTZXJ2ZXIgVmVyc2lvbjogdmVyc2lvbi5JbmZve01ham9yOiIxIiwgTWlub3I6IjE0IiwgR2l0VmVyc2lvbjoidjEuMTQuMiIsIEdpdENvbW1pdDoiNjYwNDllM2IyMWVmZTExMDQ1NGQ2N2RmNGZhNjJiMDhlYTc5YTE5YiIsIEdpdFRyZWVTdGF0ZToiY2xlYW4iLCBCdWlsZERhdGU6IjIwMTktMDUtMTZUMTY6MTQ6NTZaIiwgR29WZXJzaW9uOiJnbzEuMTIuNSIsIENvbXBpbGVyOiJnYyIsIFBsYXRmb3JtOiJsaW51eC9hbWQ2NCJ9Cg==",
  132. "date": "Thu Sep 03 2020 07:36:04 GMT+0000 (UTC)"
  133. },
  134. "email-address": "support@weave.works"
  135. }
  136. labels:
  137. name: weave-scope
  138. roleRef:
  139. kind: ClusterRole
  140. name: weave-scope
  141. apiGroup: rbac.authorization.k8s.io
  142. subjects:
  143. - kind: ServiceAccount
  144. name: weave-scope
  145. namespace: weave
  146. - apiVersion: apps/v1
  147. kind: Deployment
  148. metadata:
  149. name: weave-scope-app
  150. annotations:
  151. cloud.weave.works/launcher-info: |-
  152. {
  153. "original-request": {
  154. "url": "/k8s/scope.yaml?k8s-version=Q2xpZW50IFZlcnNpb246IHZlcnNpb24uSW5mb3tNYWpvcjoiMSIsIE1pbm9yOiIxNCIsIEdpdFZlcnNpb246InYxLjE0LjIiLCBHaXRDb21taXQ6IjY2MDQ5ZTNiMjFlZmUxMTA0NTRkNjdkZjRmYTYyYjA4ZWE3OWExOWIiLCBHaXRUcmVlU3RhdGU6ImNsZWFuIiwgQnVpbGREYXRlOiIyMDE5LTA1LTE2VDE2OjIzOjA5WiIsIEdvVmVyc2lvbjoiZ28xLjEyLjUiLCBDb21waWxlcjoiZ2MiLCBQbGF0Zm9ybToibGludXgvYW1kNjQifQpTZXJ2ZXIgVmVyc2lvbjogdmVyc2lvbi5JbmZve01ham9yOiIxIiwgTWlub3I6IjE0IiwgR2l0VmVyc2lvbjoidjEuMTQuMiIsIEdpdENvbW1pdDoiNjYwNDllM2IyMWVmZTExMDQ1NGQ2N2RmNGZhNjJiMDhlYTc5YTE5YiIsIEdpdFRyZWVTdGF0ZToiY2xlYW4iLCBCdWlsZERhdGU6IjIwMTktMDUtMTZUMTY6MTQ6NTZaIiwgR29WZXJzaW9uOiJnbzEuMTIuNSIsIENvbXBpbGVyOiJnYyIsIFBsYXRmb3JtOiJsaW51eC9hbWQ2NCJ9Cg==",
  155. "date": "Thu Sep 03 2020 07:36:04 GMT+0000 (UTC)"
  156. },
  157. "email-address": "support@weave.works"
  158. }
  159. labels:
  160. name: weave-scope-app
  161. app: weave-scope
  162. weave-cloud-component: scope
  163. weave-scope-component: app
  164. namespace: weave
  165. spec:
  166. replicas: 1
  167. revisionHistoryLimit: 2
  168. selector:
  169. matchLabels:
  170. name: weave-scope-app
  171. app: weave-scope
  172. weave-cloud-component: scope
  173. weave-scope-component: app
  174. template:
  175. metadata:
  176. labels:
  177. name: weave-scope-app
  178. app: weave-scope
  179. weave-cloud-component: scope
  180. weave-scope-component: app
  181. spec:
  182. containers:
  183. - name: app
  184. args:
  185. - '--mode=app'
  186. command:
  187. - /home/weave/scope
  188. env: []
  189. image: 'docker.io/weaveworks/scope:1.13.1'
  190. imagePullPolicy: IfNotPresent
  191. ports:
  192. - containerPort: 4040
  193. protocol: TCP
  194. - apiVersion: v1
  195. kind: Service
  196. metadata:
  197. name: weave-scope-app
  198. annotations:
  199. cloud.weave.works/launcher-info: |-
  200. {
  201. "original-request": {
  202. "url": "/k8s/scope.yaml?k8s-version=Q2xpZW50IFZlcnNpb246IHZlcnNpb24uSW5mb3tNYWpvcjoiMSIsIE1pbm9yOiIxNCIsIEdpdFZlcnNpb246InYxLjE0LjIiLCBHaXRDb21taXQ6IjY2MDQ5ZTNiMjFlZmUxMTA0NTRkNjdkZjRmYTYyYjA4ZWE3OWExOWIiLCBHaXRUcmVlU3RhdGU6ImNsZWFuIiwgQnVpbGREYXRlOiIyMDE5LTA1LTE2VDE2OjIzOjA5WiIsIEdvVmVyc2lvbjoiZ28xLjEyLjUiLCBDb21waWxlcjoiZ2MiLCBQbGF0Zm9ybToibGludXgvYW1kNjQifQpTZXJ2ZXIgVmVyc2lvbjogdmVyc2lvbi5JbmZve01ham9yOiIxIiwgTWlub3I6IjE0IiwgR2l0VmVyc2lvbjoidjEuMTQuMiIsIEdpdENvbW1pdDoiNjYwNDllM2IyMWVmZTExMDQ1NGQ2N2RmNGZhNjJiMDhlYTc5YTE5YiIsIEdpdFRyZWVTdGF0ZToiY2xlYW4iLCBCdWlsZERhdGU6IjIwMTktMDUtMTZUMTY6MTQ6NTZaIiwgR29WZXJzaW9uOiJnbzEuMTIuNSIsIENvbXBpbGVyOiJnYyIsIFBsYXRmb3JtOiJsaW51eC9hbWQ2NCJ9Cg==",
  203. "date": "Thu Sep 03 2020 07:36:04 GMT+0000 (UTC)"
  204. },
  205. "email-address": "support@weave.works"
  206. }
  207. labels:
  208. name: weave-scope-app
  209. app: weave-scope
  210. weave-cloud-component: scope
  211. weave-scope-component: app
  212. namespace: weave
  213. spec:
  214. ports:
  215. - name: app
  216. port: 80
  217. protocol: TCP
  218. targetPort: 4040
  219. selector:
  220. name: weave-scope-app
  221. app: weave-scope
  222. weave-cloud-component: scope
  223. weave-scope-component: app
  224. - apiVersion: apps/v1
  225. kind: Deployment
  226. metadata:
  227. name: weave-scope-cluster-agent
  228. annotations:
  229. cloud.weave.works/launcher-info: |-
  230. {
  231. "original-request": {
  232. "url": "/k8s/scope.yaml?k8s-version=Q2xpZW50IFZlcnNpb246IHZlcnNpb24uSW5mb3tNYWpvcjoiMSIsIE1pbm9yOiIxNCIsIEdpdFZlcnNpb246InYxLjE0LjIiLCBHaXRDb21taXQ6IjY2MDQ5ZTNiMjFlZmUxMTA0NTRkNjdkZjRmYTYyYjA4ZWE3OWExOWIiLCBHaXRUcmVlU3RhdGU6ImNsZWFuIiwgQnVpbGREYXRlOiIyMDE5LTA1LTE2VDE2OjIzOjA5WiIsIEdvVmVyc2lvbjoiZ28xLjEyLjUiLCBDb21waWxlcjoiZ2MiLCBQbGF0Zm9ybToibGludXgvYW1kNjQifQpTZXJ2ZXIgVmVyc2lvbjogdmVyc2lvbi5JbmZve01ham9yOiIxIiwgTWlub3I6IjE0IiwgR2l0VmVyc2lvbjoidjEuMTQuMiIsIEdpdENvbW1pdDoiNjYwNDllM2IyMWVmZTExMDQ1NGQ2N2RmNGZhNjJiMDhlYTc5YTE5YiIsIEdpdFRyZWVTdGF0ZToiY2xlYW4iLCBCdWlsZERhdGU6IjIwMTktMDUtMTZUMTY6MTQ6NTZaIiwgR29WZXJzaW9uOiJnbzEuMTIuNSIsIENvbXBpbGVyOiJnYyIsIFBsYXRmb3JtOiJsaW51eC9hbWQ2NCJ9Cg==",
  233. "date": "Thu Sep 03 2020 07:36:04 GMT+0000 (UTC)"
  234. },
  235. "email-address": "support@weave.works"
  236. }
  237. labels:
  238. name: weave-scope-cluster-agent
  239. app: weave-scope
  240. weave-cloud-component: scope
  241. weave-scope-component: cluster-agent
  242. namespace: weave
  243. spec:
  244. replicas: 1
  245. revisionHistoryLimit: 2
  246. selector:
  247. matchLabels:
  248. name: weave-scope-cluster-agent
  249. app: weave-scope
  250. weave-cloud-component: scope
  251. weave-scope-component: cluster-agent
  252. template:
  253. metadata:
  254. labels:
  255. name: weave-scope-cluster-agent
  256. app: weave-scope
  257. weave-cloud-component: scope
  258. weave-scope-component: cluster-agent
  259. spec:
  260. containers:
  261. - name: scope-cluster-agent
  262. args:
  263. - '--mode=probe'
  264. - '--probe-only'
  265. - '--probe.kubernetes.role=cluster'
  266. - '--probe.http.listen=:4041'
  267. - '--probe.publish.interval=4500ms'
  268. - '--probe.spy.interval=2s'
  269. - 'weave-scope-app.weave.svc.cluster.local:80'
  270. command:
  271. - /home/weave/scope
  272. env: []
  273. image: 'docker.io/weaveworks/scope:1.13.1'
  274. imagePullPolicy: IfNotPresent
  275. ports:
  276. - containerPort: 4041
  277. protocol: TCP
  278. resources:
  279. limits:
  280. memory: 2000Mi
  281. requests:
  282. cpu: 25m
  283. memory: 80Mi
  284. serviceAccountName: weave-scope
  285. - apiVersion: apps/v1
  286. kind: DaemonSet
  287. metadata:
  288. name: weave-scope-agent
  289. annotations:
  290. cloud.weave.works/launcher-info: |-
  291. {
  292. "original-request": {
  293. "url": "/k8s/scope.yaml?k8s-version=Q2xpZW50IFZlcnNpb246IHZlcnNpb24uSW5mb3tNYWpvcjoiMSIsIE1pbm9yOiIxNCIsIEdpdFZlcnNpb246InYxLjE0LjIiLCBHaXRDb21taXQ6IjY2MDQ5ZTNiMjFlZmUxMTA0NTRkNjdkZjRmYTYyYjA4ZWE3OWExOWIiLCBHaXRUcmVlU3RhdGU6ImNsZWFuIiwgQnVpbGREYXRlOiIyMDE5LTA1LTE2VDE2OjIzOjA5WiIsIEdvVmVyc2lvbjoiZ28xLjEyLjUiLCBDb21waWxlcjoiZ2MiLCBQbGF0Zm9ybToibGludXgvYW1kNjQifQpTZXJ2ZXIgVmVyc2lvbjogdmVyc2lvbi5JbmZve01ham9yOiIxIiwgTWlub3I6IjE0IiwgR2l0VmVyc2lvbjoidjEuMTQuMiIsIEdpdENvbW1pdDoiNjYwNDllM2IyMWVmZTExMDQ1NGQ2N2RmNGZhNjJiMDhlYTc5YTE5YiIsIEdpdFRyZWVTdGF0ZToiY2xlYW4iLCBCdWlsZERhdGU6IjIwMTktMDUtMTZUMTY6MTQ6NTZaIiwgR29WZXJzaW9uOiJnbzEuMTIuNSIsIENvbXBpbGVyOiJnYyIsIFBsYXRmb3JtOiJsaW51eC9hbWQ2NCJ9Cg==",
  294. "date": "Thu Sep 03 2020 07:36:04 GMT+0000 (UTC)"
  295. },
  296. "email-address": "support@weave.works"
  297. }
  298. labels:
  299. name: weave-scope-agent
  300. app: weave-scope
  301. weave-cloud-component: scope
  302. weave-scope-component: agent
  303. namespace: weave
  304. spec:
  305. minReadySeconds: 5
  306. selector:
  307. matchLabels:
  308. name: weave-scope-agent
  309. app: weave-scope
  310. weave-cloud-component: scope
  311. weave-scope-component: agent
  312. template:
  313. metadata:
  314. labels:
  315. name: weave-scope-agent
  316. app: weave-scope
  317. weave-cloud-component: scope
  318. weave-scope-component: agent
  319. spec:
  320. containers:
  321. - name: scope-agent
  322. args:
  323. - '--mode=probe'
  324. - '--probe-only'
  325. - '--probe.kubernetes.role=host'
  326. - '--probe.publish.interval=4500ms'
  327. - '--probe.spy.interval=2s'
  328. - '--probe.docker.bridge=docker0'
  329. - '--probe.docker=true'
  330. - 'weave-scope-app.weave.svc.cluster.local:80'
  331. command:
  332. - /home/weave/scope
  333. env: []
  334. image: 'docker.io/weaveworks/scope:1.13.1'
  335. imagePullPolicy: IfNotPresent
  336. resources:
  337. limits:
  338. memory: 2000Mi
  339. requests:
  340. cpu: 100m
  341. memory: 100Mi
  342. securityContext:
  343. privileged: true
  344. volumeMounts:
  345. - name: scope-plugins
  346. mountPath: /var/run/scope/plugins
  347. - name: sys-kernel-debug
  348. mountPath: /sys/kernel/debug
  349. - name: docker-socket
  350. mountPath: /var/run/docker.sock
  351. dnsPolicy: ClusterFirstWithHostNet
  352. hostNetwork: true
  353. hostPID: true
  354. tolerations:
  355. - effect: NoSchedule
  356. operator: Exists
  357. - effect: NoExecute
  358. operator: Exists
  359. volumes:
  360. - name: scope-plugins
  361. hostPath:
  362. path: /var/run/scope/plugins
  363. - name: sys-kernel-debug
  364. hostPath:
  365. path: /sys/kernel/debug
  366. - name: docker-socket
  367. hostPath:
  368. path: /var/run/docker.sock
  369. updateStrategy:
  370. type: RollingUpdate

安装weave scope

  1. kubectl apply -f init.yaml
  2. kubectl get pods -n weave -o wide -w

修改为NodePort

  1. kubectl patch svc $(kubectl get svc -n weave |grep weave-scope-app |awk '{print $1}') -p '{"spec":{"type": "NodePort"}}' -n weave
  2. kubectl get svc -n weave |grep weave-scope-app

format_png

感觉看起来还行 可以帮助理解服务之间的调用

format_png 1

点击pod 并选择边上container里的pod在点击Attach

然后就嘎住了。哈哈哈 不能进入到pod里

format_png 2

describe和log 功能都正常

format_png 3

发表评论

表情:
评论列表 (有 0 条评论,236人围观)

还没有评论,来说两句吧...

相关阅读

    相关 linux体验

                  linux正式公布是在1991年,我想大家对很多linux版本都耳熟能详,当然了,各个版本各有所长,但是同出一门,都使用了linux内核,它是一套可

    相关 队列体验

    队列:只允许在一端进行插入数据操作,在另一端进行删除数据操作的特殊线性表。 进行插入操作的一端称为队尾,通常称为入队列;进行删除操作的一端称为队头,通常称为出队列。 队列具有先