Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Kata and Node Feature Discovery #1010

Merged
merged 1 commit into from Jan 20, 2022

Conversation

pixiake
Copy link
Collaborator

@pixiake pixiake commented Jan 15, 2022

What does this PR do ?

Support installation of kata-container and node-feature-discovery using kubekey.

Kata Containers is an open source community working to build a secure container runtime with lightweight virtual machines that feel and perform like containers, but provide stronger workload isolation using hardware virtualization technology as a second layer of defense.

NodeFeatureDiscovery detects hardware features available on each node in a Kubernetes cluster, and advertises those features using node labels.

How to use ?

add spec.kubernetes.enableKata: true or spec.kubernetes.enableNodeFeatureDiscovery: true

  • Kata will only take effect if the container manager uses containerd and cri-o.

example:

apiVersion: kubekey.kubesphere.io/v1alpha2
kind: Cluster
metadata:
  name: sample
spec:
  hosts:
  - {name: node1, address: 192.168.6.6, internalAddress: 192.168.6.6, password: Qcloud@123}
  roleGroups:
    etcd:
    - node1
    master:
    - node1
    worker:
    - node1
    ## Specify the node role as registry. Only one node can be set as registry.
    registry:
    - node1
  controlPlaneEndpoint:
    ##Internal loadbalancer for apiservers
    #internalLoadbalancer: haproxy

    domain: lb.kubesphere.local
    address: ""
    port: 6443
  kubernetes: 
    version: v1.21.5
    clusterName: cluster.local
    enableKata: true      # enable kata-containers,and specify `runtimeClassName: kata-qemu` in the Pod spec to create kata sandbox.
    enableNodeFeatureDiscovery: true  # enable node-feature-discovery
  network:
    plugin: calico
    kubePodsCIDR: 10.233.64.0/18
    kubeServiceCIDR: 10.233.0.0/18
    # multus support. https://github.com/k8snetworkplumbingwg/multus-cni
    enableMultusCNI: false
  registry:
    ## `docker registry` is used to create local registry by default.  
    ## `harbor` can be also set for type.
    # type: ""  
    privateRegistry: dockerhub.kubekey.local
    registryMirrors: []
    insecureRegistries: []
  addons: []

Signed-off-by: pixiake guofeng@yunify.com

@ks-ci-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: pixiake

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ks-ci-bot ks-ci-bot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jan 15, 2022
@pixiake pixiake linked an issue Jan 15, 2022 that may be closed by this pull request
// load balancer
"haproxy": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: "library", Repo: "haproxy", Tag: "2.3", Group: kubekeyv1alpha2.Worker, Enable: kubeConf.Cluster.ControlPlaneEndpoint.IsInternalLBEnabled()},
// kata-deploy
"kata-deploy": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: kubekeyv1alpha2.DefaultKubeImageNamespace, Repo: "kata-deploy", Tag: "stable", Group: kubekeyv1alpha2.Worker, Enable: kubeConf.Cluster.Kubernetes.EnableKata},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there only worker nodes that can use the kata containers?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, kata does not support host network, the control-plane components uses runc, so kata is not needed on the control-plane.

EtcdBackupScriptDir string `yaml:"etcdBackupScript" json:"etcdBackupScript,omitempty"`
ContainerManager string `yaml:"containerManager" json:"containerManager,omitempty"`
ContainerRuntimeEndpoint string `yaml:"containerRuntimeEndpoint" json:"containerRuntimeEndpoint,omitempty"`
EnableNodeFeatureDiscovery bool `yaml:"enableNodeFeatureDiscovery" json:"enableNodeFeatureDiscovery,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you think to use a struct to configure the kata and NodeFeatureDiscovery?
Just like:

Kata:
  enable: true
  moreOptions: xxxx
NodeFeatureDiscovery:
  enable: false

BTW, if we use this structure, in the golang struct, the type of the enable field we can set as *bool. This allows you to distinguish between "true", "false" and "not set".

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, I will update it.

Signed-off-by: pixiake <guofeng@yunify.com>
@ks-ci-bot ks-ci-bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jan 17, 2022
@24sama
Copy link
Collaborator

24sama commented Jan 20, 2022

/lgtm

@ks-ci-bot ks-ci-bot added the lgtm Indicates that a PR is ready to be merged. label Jan 20, 2022
@ks-ci-bot
Copy link
Collaborator

LGTM label has been added.

Git tree hash: 1bd18bd41e81629406f9a016518c052dade7500a

@ks-ci-bot ks-ci-bot merged commit b451d94 into kubesphere:master Jan 20, 2022
@24sama
Copy link
Collaborator

24sama commented Jan 20, 2022

/cherrypick release-2.0

@ks-ci-bot
Copy link
Collaborator

@24sama: new pull request created: #1024

In response to this:

/cherrypick release-2.0

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support integrated secure container runtime: kata
3 participants