当前位置:网站首页>Cross cluster deployment of helm applications using karmada [cloud native open source]
Cross cluster deployment of helm applications using karmada [cloud native open source]
2022-06-27 10:06:00 【Hua Weiyun】
author : Huawei cloud's native open source team
background
By using Kubernetes Native API And provide advanced scheduling function ,Karmada It has implemented the... In the multi cluster scenario Kubernetes resources ( Include CRD) Distribution and management of . However, the current multi cluster application is often not a single resource form , Use Helm The use scenario of packaging applications is also very common .
With the help of Karmada Native API The ability to support ,Karmada Can use Flux Make it easy Helm Cross cluster deployment of applications .

Deploy Karmada
To deploy Karmada, You can refer to the community installation documentation (https://github.com/karmada-io/karmada/blob/master/docs/installation/installation.md). If you want to experience it quickly Karmada, We propose to adopt hack/local-up-karmada.sh Construct a Karmada Development environment of .
Deploy Flux
stay Karmada In control surface , You need to install Flux Of CRD, But there is no need to install Flux The controller is based on CRD Created CR object , They are considered resource templates , Not specific resource instances . be based on Karmada Of work API, They will be encapsulated as a work Object to the member cluster , Finally, the members in the cluster Flux The controller is tuned .
kubectl apply -k github.com/fluxcd/flux2/manifests/crds?ref=main --kubeconfig ~/.kube/karmada.configIn a member cluster , You can install the complete... Based on the following command Flux Components .
flux install --kubeconfig ~/.kube/members.config --context member1flux install --kubeconfig ~/.kube/members.config --context member2You can refer to the documentation here (https://fluxcd.io/docs/installation/) For more detailed installation Flux The details of the .
Tips : If you want to manage all your clusters based on HelmRelease Application , You need to install... In all your member clusters Flux.
Helm release distribution
Ready for work , Next, we will use a podinfo As an example, it demonstrates how to complete Helm chart distribution .
1. stay Karmada Define a in the control plane Flux Of HelmRepository CR Object and a HelmRelease CR object . They will be treated as resource templates .
apiVersion: source.toolkit.fluxcd.io/v1beta2kind: HelmRepositorymetadata:name: podinfospec:interval: 1murl: https://stefanprodan.github.io/podinfo---
apiVersion: helm.toolkit.fluxcd.io/v2beta1kind: HelmReleasemetadata:name: podinfospec:interval: 5mchart:spec:chart: podinfoversion: 5.0.3sourceRef:kind: HelmRepositoryname: podinfo2. Define a Karmada Of PropagationPolicy Object to distribute their resource instances to the member cluster :
apiVersion: policy.karmada.io/v1alpha1kind: PropagationPolicymetadata:name: helm-repospec:resourceSelectors:- apiVersion: source.toolkit.fluxcd.io/v1beta2kind: HelmRepositoryname: podinfoplacement:clusterAffinity:clusterNames:- member1- member2---
apiVersion: policy.karmada.io/v1alpha1kind: PropagationPolicymetadata:name: helm-releasespec:resourceSelectors:- apiVersion: helm.toolkit.fluxcd.io/v2beta1kind: HelmReleasename: podinfoplacement:clusterAffinity:clusterNames:- member1- member2The above configuration will make Flux The resource object of is distributed to the member cluster member1 and member2 in .
3. Submit the above objects to Karmada-apiserver:
kubectl apply -f ../helm/ --kubeconfig ~/.kube/karmada.configYou will get the following output :
helmrelease.helm.toolkit.fluxcd.io/podinfo createdhelmrepository.source.toolkit.fluxcd.io/podinfo createdpropagationpolicy.policy.karmada.io/helm-release createdpropagationpolicy.policy.karmada.io/helm-repo created4. Switch to the member cluster to verify whether the application is successfully distributed
helm --kubeconfig ~/.kube/members.config --kube-context member1 listYou will get the following output :
.png)
be based on Karmada Of PropagationPolicy, You have the flexibility to Helm The application is published to the cluster you expect .
Customize for a specific cluster Helm application
The above example shows how the same Helm Application distribution to Karmada Multiple clusters in . Besides , You can still use it Karmada Of OverridePolicy Customize for a specific cluster Helm application . for example , The above applications include a Pod copy , If you just want to change member1 The applications in the cluster contain Pod replications , You can refer to the following OverridePolicy Strategy .
1. Define a Karmada Of OverridePolicy object .
apiVersion: policy.karmada.io/v1alpha1kind: OverridePolicymetadata:name: example-overridenamespace: defaultspec:resourceSelectors:- apiVersion: helm.toolkit.fluxcd.io/v2beta1kind: HelmReleasename: podinfooverrideRules:- targetCluster:clusterNames:- member1overriders:plaintext:- path: "/spec/values"operator: addvalue:replicaCount: 22. Submit the above objects to Karmada-apiserver:
kubectl apply -f example-override.yaml --kubeconfig ~/.kube/karmada.configYou will get the following output :
overridepolicy.policy.karmada.io/example-override created3. stay Karmada After applying the above strategy in the control plane , You'll find that member1 Members in the cluster Pod The number of instances has been changed to 2, but member2 Those in the cluster remain the same .
kubectl --kubeconfig ~/.kube/members.config --context member1 get poYou will get the following output :
NAME READY STATUS RESTARTS AGEpodinfo-68979685bc-6wz6s 1/1 Running 0 6m28spodinfo-68979685bc-dz9f6 1/1 Running 0 7m42sReference documents :
https://github.com/karmada-io/karmada/blob/master/docs/working-with-flux.md
attach :Karmada Community technology exchange address
add to Karmada Community assistant wechat k8s2222 Enter the community communication group , and Maintainer Zero distance .
Project address
https://github.com/karmada-io/karmada
Slack Address :
.jpeg)
边栏推荐
- 片刻喘息,美国电子烟巨头禁令推迟,可暂时继续在美销售产品
- 强化学习中好奇心机制
- 6月23日《Rust唠嗑室》第三期B站视频地址
- Border affects the height of the parent element - solution
- 小哥凭“量子速读”绝技吸粉59万:看街景图0.1秒,“啪的一下”在世界地图精准找到!...
- CPU design (single cycle and pipeline)
- QT运行显示 This application failed to start because it could not find or load the Qt platform plugin
- [hcie-rs review mind map] - STP
- Introduction to the use of Arduino progmem static storage area
- R语言plotly可视化:plotly可视化基础小提琴图(basic violin plot in R with plotly)
猜你喜欢
测试同学怎么参与codereview

C language learning day_ 06

Comparison between new and old interfaces

How do I get the STW (pause) time of a GC (garbage collector)?

CPU design (single cycle and pipeline)
![[registration] infrastructure design: from architecture hot issues to industry changes | tf63](/img/75/b83aaf9610987f695eefe350f8170e.jpg)
[registration] infrastructure design: from architecture hot issues to industry changes | tf63

小哥凭“量子速读”绝技吸粉59万:看街景图0.1秒,“啪的一下”在世界地图精准找到!...

新旧两个界面对比

.NET 中的引用程序集

oracle触发器 存储过程同时写入
随机推荐
Basic violin plot in R with plot
前馈-反馈控制系统设计(过程控制课程设计matlab/simulink)
JS array splicing "suggested collection"
小哥凭“量子速读”绝技吸粉59万:看街景图0.1秒,“啪的一下”在世界地图精准找到!...
Bluetooth health management device based on stm32
flutter 微信分享
文件名设置导致writelines写入报错:OSError: [Errno 22] Invalid argument
R langage plotly visualisation: visualisation de plusieurs histogrammes normalisés d'ensembles de données et ajout d'une courbe de densité KDE à l'histogramme, réglage de différents histogrammes en ut
Xiaobai can also understand how the basic network 03 | OSI model works (classic push)
mongodb跨主机数据库拷贝以及常用命令
R language plot visualization: visualize the normalized histograms of multiple data sets, add density curve KDE to the histograms, set different histograms to use different bin sizes, and add edge whi
leetcode:968. Monitor the binary tree [tree DP, maintain the three states of each node's subtree, it is very difficult to think of the right as a learning, analogous to the house raiding 3]
js 所有的网络请求方式
Use aspese slides to convert PPT to PDF
2021 CSP J2入门组 CSP-S2提高组 第2轮 视频与题解
User authentication technology
Vector:: data() pointer usage details
Prometheus alarm process and related time parameter description
dns备用服务器信息,dns服务器地址(dns首选和备用填多少)
R语言plotly可视化:plotly可视化二维直方图等高线图、在等高线上添加数值标签、自定义标签字体色彩、设置鼠标悬浮显示效果(Styled 2D Histogram Contour)