Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to hack Rancher Kubernetes

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

In Rancher, because Kubernetes is deployed based on the Cattle engine, after the Kubernetes deployment is complete, we can clearly see the overall deployment through Link Graph.

Since it is based on the Cattle engine deployment, that is to say, two compose files are required, and the compose file of the K8s engine is placed under https://github.com/rancher/rancher-catalog/tree/master/templates, in which there are two related directories kubernetes and k8sMagi K8s are used by Rancher1.2, while kubernetes is used after Rancher1.2.

In order that we can hack the deployment of rancher K8s ourselves, we can fork rancher-catalog on github. At the same time, we also need to modify the repo address of the default catalog in Rancher. You can find the configuration item named catalog.url under the http:///v1/settings page, and then go to edit and modify. For example, here I change the address of the library library to my own https://github.com/niusmallnan/rancher-catalog.git.

At this point, we can modify it to find a more practical scene. We all know that the pod of K8s depends on a basic image. The default address of this image is blocked by GFW. Generally, we adjust the startup parameters of kubelet to re-specify the address of the image, for example, to a domestic image source-pod-infra-container-p_w_picpath=index.tenxcloud.com/google_containers/pause:2.0. If we want to have rancher K8s deploy with this parameter automatically, we can directly modify the K8s compose file in the private rancher-catalog.

Wait a moment after modification (mainly to update rancher-server to the new catalog compose file), add a K8s env and add the host,k8s engine to it and start automatic deployment. After deployment, we can see the compose file of Kubernetes Stack, which already has the startup parameter-- pod-infra-container-p_w_picpath.

In this way, we no longer have to manually import the pod base image when adding pod.

In compose file, the basic image for deploying k8s is rancher/k8s. The Dockerfile of this image can be seen in the K8s branch maintained by rancher, such as in the rancher-k8s 1.2.4 branch:

In this way, if you want to deeply customize the rancher-k8s distribution, you can re-build the relevant images and deploy your own distribution through rancher-compose.

Original source: Rancher Labs

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report