[kubernetes]-k8s使用HNC创建vcluster

导语:k8s使用HNC创建vcluster。记录一下 大致流程 。

# Select the latest version of HNC
HNC_VERSION=v0.8.0

# Forbid HNC from modifying system namespaces
kubectl label ns kube-system hnc.x-k8s.io/excluded-namespace=true --overwrite
kubectl label ns kube-public hnc.x-k8s.io/excluded-namespace=true --overwrite
kubectl label ns kube-node-lease hnc.x-k8s.io/excluded-namespace=true --overwrite

# Install HNC. Afterwards, wait up to 30s for HNC to refresh the certificates on its webhooks.
kubectl apply -f https://github.com/kubernetes-sigs/multi-tenancy/releases/download/hnc-${HNC_VERSION}/hnc-manager.yaml 
kubectl create ns hnc-parent
kubectl create ns hnc-child-1
kubectl create ns hnc-child-2

kubectl hns set hnc-child-1 -p hnc-parent
kubectl hns set hnc-child-2 -p hnc-parent
kubectl hns tree -A

默认情况下, parent namespace下的所属的Role 和 RoleBinding 对象会传递给 child 命名空间对象。

kubectl create role pod-reader --verb=get --verb=list --verb=watch --resource=pods -n hnc-parent

验证下 hnc-child-{1,2} 命名空间下是否能看到相同的 role

kubectl get role -n hnc-child-1 --show-labels
kubectl get role -n hnc-child-2 --show-labels

没有继续测试,后续创建secret来控制ns的权限应该就行了吧。看github活跃不太行了。

更详细使用方式

https://github.com/sighupio/hnc-example-use-cases/tree/master/use-cases/self-provision

http://www.manongjc.com/detail/58-dhayhzsfmlhlneb.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

爷来辣

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值