当前位置:网站首页>Cross cluster deployment of helm applications using karmada
Cross cluster deployment of helm applications using karmada
2022-06-28 18:50:00 【Huawei cloud developer Alliance】
Abstract : With the help of Karmada Native API The ability to support ,Karmada Can use Flux Make it easy Helm Cross cluster deployment of applications .
This article is shared from Huawei cloud community 《 Use Karmada Realization Helm Cross cluster deployment of applications 【 Cloud native open source 】》, 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 member1
flux 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/v1beta2
kind: HelmRepository
metadata:
name: podinfo
spec:
interval: 1m
url: https://stefanprodan.github.io/podinfo ---
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
name: podinfo
spec:
interval: 5m
chart:
spec:
chart: podinfo
version: 5.0.3
sourceRef:
kind: HelmRepository
name: podinfo2. Define a Karmada Of PropagationPolicy Object to distribute their resource instances to the member cluster :
apiVersion: policy.karmada.io/v1alpha1
kind: PropagationPolicy
metadata:
name: helm-repo
spec:
resourceSelectors:
- apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: HelmRepository
name: podinfo
placement:
clusterAffinity:
clusterNames:
- member1
- member2---
apiVersion: policy.karmada.io/v1alpha1
kind: PropagationPolicy
metadata:
name: helm-release
spec:
resourceSelectors:
- apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
name: podinfo
placement:
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 created
helmrepository.source.toolkit.fluxcd.io/podinfo created
propagationpolicy.policy.karmada.io/helm-release created
propagationpolicy.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 :

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/v1alpha1
kind: OverridePolicy
metadata:
name: example-override
namespace: default
spec:
resourceSelectors:
- apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
name: podinfo
overrideRules:
- targetCluster:
clusterNames:
- member1
overriders:
plaintext:
- path: "/spec/values"
operator: add
value:
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 AGE
podinfo-68979685bc-6wz6s 1/1 Running 0 6m28s
podinfo-68979685bc-dz9f6 1/1 Running 0 7m42sReference documents :
karmada/working-with-flux.md at master · karmada-io/karmada · GitHub
attach :Karmada Community technology exchange address
add to Karmada Community assistant wechat k8s2222 Enter the community communication group , and Maintainer Zero distance .
Project address :
GitHub - karmada-io/karmada: Open, Multi-Cloud, Multi-Cluster Kubernetes Orchestration
Slack Address :https://slack.cncf.io/
Click to follow , The first time to learn about Huawei's new cloud technology ~
边栏推荐
- Steam education to break the barriers between disciplines
- 内存抖动
- 180.1.连续登录N天(数据库)
- postgresql数据库docker
- Win 10创建一个gin框架的项目
- Lumiprobe非荧光叠丨氮化物研究丨3-叠丨氮丙醇
- OOM out of memory 内存溢出
- Voice network VQA: make the user's subjective experience of unknown video quality in real-time interaction known
- Mybayis之核心主件分析
- Native implementation Net5.0+ custom log
猜你喜欢

【C#】详解值类型和引用类型区别

牛津大学教授Michael Wooldridge:AI社区近40年如何看待神经网络

POI excel conversion tool

idea其他分支合并到dev分支

618活动季——百数低代码平台特享折扣来临

PHP使用栈解决迷宫问题

Win 10创建一个gin框架的项目

Lumiprobe丨Lumizol RNA 提取试剂解决方案

1 goal, 3 fields, 6 factors and 9 links of digital transformation

Michael Wooldridge, professeur à l'Université d'Oxford: comment la communauté de l'IA voit les réseaux neuronaux depuis près de 40 ans
随机推荐
Business layer modification - reverse modification based on the existing framework
Openfire用户以及群组关系移植
180.1.连续登录N天(数据库)
About covariance and correlation
Can I open an account today and buy shares today? Is it safe to open an account online?
About Statistical Distributions
PostgreSQL database docker
进阶高级-业务事务设计 开发入门
leetcode 1689. Partitioning into minimum number of deci binary numbers
Professor Michael Wooldridge of Oxford University: how the AI community views neural networks in the past 40 years
推荐两款超高质量的壁纸软件
数字化转型的1个目标,3大领域,6大因素和9个环节
About Significance Tests
Steam education to break the barriers between disciplines
Concept and code implementation of heap
curl: (56) Recv failure: Connection reset by peer
浦发银行软件测试面试真题(小编面试亲测)
Oom out of memory memory overflow
An in-depth analysis of the election mechanism in kubernetes
双功能交联剂丨Lumiprobe 磺基花青7二羧酸研究