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

docs: add proposal of Karmada Self-Signed Certificate Content Standar… #6189

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

tiansuo114
Copy link
Contributor

@tiansuo114 tiansuo114 commented Mar 7, 2025

What type of PR is this?
/kind documentation

What this PR does / why we need it:
Design documentation for supporting karmada's new self-signed certificate system
Which issue(s) this PR fixes:
Part of 6091

Special notes for your reviewer:
@XiShanYongYe-Chang
@chaosi-zju
Does this PR introduce a user-facing change?:


…dization

Signed-off-by: tiansuo114 <zhaoyi_114@outlook.com>
@karmada-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign chaunceyjiang for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

@karmada-bot karmada-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Mar 7, 2025
@codecov-commenter
Copy link

codecov-commenter commented Mar 7, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 47.89%. Comparing base (824bd8d) to head (597712c).
Report is 47 commits behind head on master.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6189      +/-   ##
==========================================
- Coverage   47.97%   47.89%   -0.08%     
==========================================
  Files         674      676       +2     
  Lines       55841    55978     +137     
==========================================
+ Hits        26788    26810      +22     
- Misses      27305    27418     +113     
- Partials     1748     1750       +2     
Flag Coverage Δ
unittests 47.89% <ø> (-0.08%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tiansuo114
Copy link
Contributor Author

Preliminary Design Document Discussion

This document is an initial design draft. However, there are some unresolved questions regarding the overall system design that I have raised in the document. For clarity, I will describe the issues again here.

1. Secret Generation During Cluster Deployment

  • When deploying the cluster using karmadactl init, a karmada-apiserver.config file is generated locally.
  • This file is used by client components to obtain the certificates required to connect to the server.
  • However, after deploying the operator with /karmadactl init, I did not find any secret in the cluster that corresponds to this configuration.
  • Question: What is the design intention behind this part?

2. Generating Individual Certificate Files for Each Client

I have encountered some design issues when considering generating independent, usable certificate files for each client. I currently have two approaches:

Option 1:

  • Generate an independent authentication certificate file for each client component.
  • Modify the client component command flags so that each client reads its own certificate file for authentication.

Option 2:

  • Continue using the karmada-apiserver.config file for client components.
  • In the karmada-apiserver.config file, store different certificate contents for different client components using a multi-user approach.
  • Modify the related mechanisms (it's unclear whether this is feasible at the moment) so that each client loads its corresponding certificate data and uses that for authentication.

3. Using a Consistent Certificate Across Different Servers for the Same Client

  • This may require adjustments to the apiserver implementation logic.
  • First: Decouple the generated certificates for client components from binding to a specific server.
  • Second: Different Karmada workspaces should have different CA root certificates.
  • Challenge: How to allow client components to use a consistent certificate for authentication when the CA root certificates differ.
  • Proposed Solution:
    During the karmadactl init and the deployment of a new Karmada operator on a new workspace, add a configuration option that allows the new workspace to use an existing CA root certificate as its own. This would help ensure the possibility of mutual communication.

@XiShanYongYe-Chang @chaosi-zju

- **8 Server Components:**
1. karmada-apiserver
2. karmada-scheduler
3. karmada-controller-manager
Copy link
Contributor

Choose a reason for hiding this comment

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

What is karmada-controller-manager used for as a server?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In my understanding, the use of karmada-controller-manager as a server component is roughly: Karmada-controller-manager is Karmada The core control plane component of the multi-cluster orchestration system manages some controllers (such as execution,binding, etc.) to perform cluster resource orchestration and service governance functions

If there is any mistake in my answer or understanding of the question, please let me know and I will correct it in time😭

Copy link
Contributor

Choose a reason for hiding this comment

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

When we determine whether a component assumes the role of a server, we can think from the perspectives of who the clients accessing it are and what its functions are as a server. You mentioned "metrics" in the following comment. When acting as the provider of metrics, the controller-manager serves as the server.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am very sorry that my understanding here is not correct. After I confirmed again,karmada-controller-manager does not seem to have similar functions to server-side components

Comment on lines 57 to 64
4. karmada-cluster-controller
5. karmada-policy-controller
6. karmada-work-controller
7. karmada-binding-controller
8. karmada-status-controller
9. karmada-federated-resource-controller
10. karmada-propagation-controller
11. karmada-execution-controller
Copy link
Contributor

Choose a reason for hiding this comment

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

Do the different Controllers inside the karmada-controller-manager need to be handled separately?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we should generate a client certificate for controller-manager as a whole to communicate with karmada-apiserver, and a server certificate for controller-manager's API endpoints (health check and metrics).

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should generate a client certificate for controller-manager as a whole to communicate with karmada-apiserver

Agree, these Controllers should be regarded as a whole, that is, the karmada-controller-manager. Therefore, for the sake of easy understanding, you can simply write "karmada-controller-manager".

and a server certificate for controller-manager's API endpoints (health check and metrics)

This is a good concern. Although currently we don't have the configuration for certificate verification regarding health check and metrics (please correct me if I'm wrong).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, after confirmation, my understanding is wrong. karmada-control-manager does not seem to have similar functions as a server-side component. Therefore, I think it is not necessary to generate a server-side certificate for Karmada-Control-Manager, but only a unified client authentication certificate for the client components under its management


- Generate Independent Secrets:
- Modify the certificate upload logic in `operator/pkg/tasks/init/upload.go` to replace the shared certificate handling with individual Secret creation for each component.
- Add new functions to create these independent Secrets and enforce new RBAC rules to restrict each component’s access to its own certificate.
Copy link
Contributor

Choose a reason for hiding this comment

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

enforce new RBAC rules to restrict each component’s access to its own certificate.

Does the component need the RBAC permission for the certificate, considering that the secret is mounted onto it as a volume?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Your observation is correct. There is some misunderstanding here, when the certificate Secret is mounted to the component as a volume, the component itself does not need additional RBAC permissions to access the certificate files.

This is because:

  1. The mounting of Secret is done by kubelet: kubelet is responsible for mounting the contents of Secret as a file inside the container.

  2. Applications in containers only need file system permissions: Applications in containers only need read permissions to the file system, not access to the Kubernetes API.

  3. Only the component responsible for managing secrets requires RBAC permissions: For example, karmada-operator needs to have the appropriate RBAC permissions to create and manage these secrets.

Therefore, for the management of certificate Secret, we should follow the following policies:

  1. Keep the management rights of karmada-operator on all certificate secrets, and ensure that Karmada-Operator can create, update, and delete related certificates.

  2. Do not add RBAC permission for other components (such as controller-manager) to access certificate Secret to avoid unnecessary permission exposure.

  3. Ensure that volume mounting is configured correctly: Each component should be able to access only the certificates it needs, preventing other components from accessing unrelated secrets.

If my understanding is not correct, I hope you can correct it

@zhzhuang-zju
Copy link
Contributor

@tiansuo114 Thank you for your proposal as it is valuable for the security of the project. In fact, the changes in the certificate configuration will ultimately be reflected in the fields of the certificate. And the proposal you put forward in your proposal mainly affects the Subject and Subject Alternative Name of the certificate. So, could you provide a comparison of the changes before and after for both the server certificate and the client certificate? Like:

Certificate:
    Data:
        Signature Algorithm: sha384WithRSAEncryption
        Issuer: CN = karmada
        Subject: O = system:masters, CN = system:admin
        X509v3 extensions:
            X509v3 Subject Alternative Name: 
                DNS:*.karmada-system.svc.cluster.local, DNS:*.karmada-system.svc, DNS:localhost, IP Address:127.0.0.1, IP 

@tiansuo114
Copy link
Contributor Author

@tiansuo114 Thank you for your proposal as it is valuable for the security of the project. In fact, the changes in the certificate configuration will ultimately be reflected in the fields of the certificate. And the proposal you put forward in your proposal mainly affects the Subject and Subject Alternative Name of the certificate. So, could you provide a comparison of the changes before and after for both the server certificate and the client certificate? Like:

Certificate:
    Data:
        Signature Algorithm: sha384WithRSAEncryption
        Issuer: CN = karmada
        Subject: O = system:masters, CN = system:admin
        X509v3 extensions:
            X509v3 Subject Alternative Name: 
                DNS:*.karmada-system.svc.cluster.local, DNS:*.karmada-system.svc, DNS:localhost, IP Address:127.0.0.1, IP 

Thank you for the detailed description. The certificate updates you mentioned primarily affect the Subject and Subject Alternative Name (SAN) fields. Below are the key differences between the certificates before and after the changes:


Before Changes (Current Implementation)

Server Certificate (karmada-apiserver)

Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number: 3120819415934316465 (0x2b4f60b956e82fb1)
        Signature Algorithm: sha256WithRSAEncryption
    Issuer: CN = karmada
    Validity
        Not Before: Mar 6 01:57:50 2025 GMT
        Not After : Mar 6 01:57:48 2026 GMT
    Subject: O = , CN = karmada-apiserver
    X509v3 extensions:
        X509v3 Subject Alternative Name:
            DNS:, DNS:.karmada-system.svc,
            DNS:.karmada-system.svc.cluster.local,
            DNS:karmada-aggregated-apiserver,
            DNS:karmada-aggregated-apiserver.karmada-system.svc.cluster.local,
            DNS:karmada-apiserver,
            DNS:karmada-apiserver.karmada-system.svc.cluster.local,
            DNS:karmada-webhook,
            DNS:karmada-webhook.karmada-system.svc,
            DNS:karmada-webhook.karmada-system.svc.cluster.local,
            DNS:kubernetes, DNS:kubernetes.default,
            DNS:kubernetes.default.svc,
            DNS:localhost,
            IP Address:127.0.0.1, IP Address:172.18.0.3, IP Address:2407:D840:51:1:0:0:0:6

Client Certificate (client-certificate-data)

Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number: 6967587319794734003 (0x60b1d7c061e193b3)
        Signature Algorithm: sha256WithRSAEncryption
    Issuer: CN = karmada
    Validity
        Not Before: Mar 6 01:57:50 2025 GMT
        Not After : Mar 6 01:57:48 2026 GMT
    Subject: O = system:masters, CN = system:admin
    X509v3 extensions:
        X509v3 Key Usage: critical
            Digital Signature, Key Encipherment
        X509v3 Extended Key Usage:
            TLS Web Server Authentication, TLS Web Client Authentication
        X509v3 Basic Constraints: critical
            CA:FALSE
        X509v3 Authority Key Identifier:
            87:3D:86:17:F6:A0:A8:D2:5B:01:95:A5:F9:BB:C9:CD:A3:88:3A:3C
        X509v3 Subject Alternative Name:
            DNS:, DNS:.karmada-system.svc,
            DNS:.karmada-system.svc.cluster.local,
            DNS:karmada-aggregated-apiserver,
            DNS:karmada-aggregated-apiserver.karmada-system.svc.cluster.local,
            DNS:karmada-apiserver,
            DNS:karmada-apiserver.karmada-system.svc.cluster.local,
            DNS:karmada-webhook,
            DNS:karmada-webhook.karmada-system.svc,
            DNS:karmada-webhook.karmada-system.svc.cluster.local,
            DNS:kubernetes, DNS:kubernetes.default,
            DNS:kubernetes.default.svc,
            DNS:localhost,
            IP Address:127.0.0.1, IP Address:172.18.0.3, IP Address:2407:D840:51:1:0:0:0:6

After Changes

Server Certificate (karmada-apiserver)

Certificate:
    Data:
        Signature Algorithm: sha256WithRSAEncryption
    Issuer: CN = karmada-apiserver-ca  # Dedicated CA per component
    Subject: CN = karmada-apiserver
    X509v3 extensions:
        X509v3 Subject Alternative Name:
            DNS:karmada-apiserver,
            DNS:karmada-apiserver.karmada-system.svc,
            DNS:karmada-apiserver.karmada-system.svc.cluster.local,
            DNS:localhost,
            IP Address:127.0.0.1
#Contains only the domain name required by the component

Client Certificate (karmada-scheduler)

Certificate:
    Data:
        Signature Algorithm: sha256WithRSAEncryption
    Issuer: CN = karmada-scheduler-ca  # Dedicated CA per component
    Subject: O = system:karmada-components, CN = system:karmada-scheduler
    X509v3 extensions:
        X509v3 Key Usage: critical
            Digital Signature, Key Encipherment
# In order to complete the function of connecting different servers, it does not contain any domain name
# Because I don't know much about the functional design that allows the same client to use consistent certificates for different servers, this could be a mistake

Signed-off-by: tiansuo114 <zhaoyi_114@outlook.com>
Signed-off-by: tiansuo114 <zhaoyi_114@outlook.com>
@karmada-bot karmada-bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 20, 2025
@tiansuo114
Copy link
Contributor Author

The content of the document has been updated according to the results of the meeting. How does it look now?
@zhzhuang-zju @XiShanYongYe-Chang

Comment on lines 34 to 39
**Expected Outcomes:**
- Issue distinct certificates for 8 server components and store them in corresponding Secrets
- Issue distinct certificates for 11 client components and store them in appropriate Secrets/ConfigMaps

### Non-Goals

Copy link
Contributor

Choose a reason for hiding this comment

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

We can clarify that this task aims to design a universal certificate segregation framework for Karmada. Based on this framework, the certificate issuance and usage of the hack installation method will be reformed. Other installation methods, such as helm, operator, and karmadactl init, are not covered for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I'll sync this change to the document right away

In addition, do you have any comments or suggestions about the revision of the article? I want to know if my current modification ideas are correct. If so, I want to start by trying to modify the bash files in the hack path and the yaml files in the artifacts/deploy path used during deployment

…ocument

Signed-off-by: tiansuo114 <zhaoyi_114@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants