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

[Feature] Add --insecure-skip-tls-verify when executing kubecm add #1041

Closed
mayooot opened this issue Dec 21, 2024 · 2 comments
Closed

[Feature] Add --insecure-skip-tls-verify when executing kubecm add #1041

mayooot opened this issue Dec 21, 2024 · 2 comments
Assignees

Comments

@mayooot
Copy link
Contributor

mayooot commented Dec 21, 2024

In my use case, I need to skip the ca, so I need to set insecure-skip-tls-verify, like:

- cluster:
    server: https://ip-public:6443
    insecure-skip-tls-verify: true

However, kubecm add does not support this operation, so I changed the source code and it worked as expect.

An example is as follows:

$ kubecm add -f example.yaml --insecure-skip-tls-verify
$ kubecm add -h 
Add KubeConfig to $HOME/.kube/config

Usage:
  kubecm add [flags]
  kubecm add [command]

Aliases:
  add, a

Examples:

# Merge test.yaml with $HOME/.kube/config
kubecm add -f test.yaml 
# Merge test.yaml with $HOME/.kube/config and add a prefix before context name
kubecm add -cf test.yaml --context-prefix test
# Merge test.yaml with $HOME/.kube/config and define the attributes used for composing the context name
kubecm add -f test.yaml --context-template user,cluster
# Merge test.yaml with $HOME/.kube/config, define the attributes used for composing the context name and add a prefix before context name
kubecm add -f test.yaml --context-template user,cluster --context-prefix demo
# Merge test.yaml with $HOME/.kube/config and override context name, it's useful if there is only one context in the kubeconfig file
kubecm add -f test.yaml --context-name test
# Merge test.yaml with $HOME/.kube/config and select the context to be added in interactive mode
kubecm add -f test.yaml --select-context
# Merge test.yaml with $HOME/.kube/config and specify the context to be added
kubecm add -f test.yaml --context context1,context2
# Add kubeconfig from stdin
cat /etc/kubernetes/admin.conf | kubecm add -f -
# Merge test.yaml with $HOME/.kube/config and skip TLS certificate verification
kubecm add -f test.yaml --insecure-skip-tls-verify


Available Commands:
  docs        Open document website

Flags:
      --context strings            specify the context to be added
      --context-name string        override context name when add kubeconfig context, when context-name is set, context-prefix and context-template parameters will be ignored
      --context-prefix string      add a prefix before context name
      --context-template strings   define the attributes used for composing the context name, available values: filename, user, cluster, context, namespace (default [context])
  -c, --cover                      overwrite local kubeconfig files
  -f, --file string                path to merge kubeconfig files
  -h, --help                       help for add
      --insecure-skip-tls-verify   if true, the server's certificate will not be checked for validity
      --select-context             select the context to be added in interactive mode

Global Flags:
      --config string   path of kubeconfig (default "$HOME/.kube/config")
      --create          Create a new kubeconfig file if not exists
  -m, --mac-notify      enable to display Mac notification banner
  -s, --silence-table   enable/disable output of context table on successful config update (default true)
  -u, --ui-size int     number of list items to show in menu at once (default 7)

Use "kubecm add [command] --help" for more information about a command.

If you want to add this feature to kubecm, I will sumit a pr.

@sunny0826
Copy link
Owner

This is an absolutely amazing feature! Please feel free to submit a PR!

@mayooot
Copy link
Contributor Author

mayooot commented Dec 24, 2024

ok, I'm done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants