Comments (8)
--etcd-arg=discovery=https://discovery.etcd.io/testing --etcd-arg=initial-cluster=
Don't do that. We do not support external management of the etcd cluster creation or member discovery process. If you are using the embedded etcd, you must let k3s itself manage etcd. If you want to manage the cluster creation / membership discovery by hand, use standalone etcd, and point k3s at that cluster with the --datastore-endpoint
option.
from k3s.
Hi @brandon, thank's for the quick response. Actually, we are having this issue using Rancher to automatically provisioning RKE2 clusters. After some hours of search, we discovered the problem is actually in k3s. We need to override some parameters of etcd (as pointed here: https://ranchermanager.docs.rancher.com/reference-guides/cluster-configuration/rancher-server-configuration/rke2-cluster-configuration#machineglobalconfig), and that was just a example of the problem. All parameters in etcd-arg that need to be override with an empty string suffer the same issue. There is any workaround for this?
from k3s.
What are the actual fields in the config that you're trying to override?
from k3s.
It will happen with any field that is an empty string by default, such as listen-metrics-urls
, wal-dir
or tls-max-version
. In any of these cases, if you try to override the value with the default one (an empty string), the error will be the same: error unmarshaling JSON: while decoding JSON: json: cannot unmarshal array into Go struct field configYAML.listen-metrics-urls of type string
, because the way k3s deal with empty strings here: https://github.com/etcd-io/etcd/blob/c2a3ca62c707f9c9d662ba94335fc019726c3bfd/server/embed/config.go#L916. In our case, we try to override listen-metrics-urls
and initial-cluster
. Any of the commands below will result in the same error:
k3s server --cluster-init --etcd-arg=listen-metrics-urls=
k3s server --cluster-init --etcd-arg=tls-max-version=
k3s server --cluster-init --etcd-arg=wal-dir=
from k3s.
I can take a look at improving handling of that, but can I ask why you're trying to set those to empty values? I could understand wanting to set no metrics URLs to disable serving metrics, but why would you set the WAL dir to an empty value? Similarly, tls-max-version wants TLS1.2
or, TLS1.3
, not an empty string.
Are you intending to unset these flags by setting them to an empty value? Thats not how the flag parser works.
from k3s.
Some of these parameters are changed by Rancher during the process of provisioning a new cluster (we are using Harvester + Rancher). I'm testing some scenarios in our infrastructure where it's needed to keep the default etcd value (empty string). A simple workaround is change the https://github.com/k3s-io/k3s/blob/94e29e2ef5d79904f730e2024c8d1682b901b2d5/pkg/daemons/executor/executor.go#L106C5-L106C83 file, validating the size of the string, changing it from:
} else if err := yaml.Unmarshal([]byte(extraArg[1]), &stringArr); err == nil {
to:
} else if err := yaml.Unmarshal([]byte(extraArg[1]), &stringArr); err == nil && (len(extraArg[1]) > 0) {
I can make a pull request if needed. A better improvement would be to use the etcd
lib to parse the parameters.
from k3s.
@brandond see pull request: #10018
from k3s.
Some of these parameters are changed by Rancher during the process of provisioning a new cluster (we are using Harvester + Rancher). I'm testing some scenarios in our infrastructure where it's needed to keep the default etcd value (empty string).
I think that might be the source of some confusion - the default isn't an empty value, and for the other --COMPONENT-arg
flags, passing through an arg with an empty value won't restore the default. What you're asking for is the ability to unset or mask a default value that is set internally by k3s. That isn't currently possible.
We can continue conversation on the PR.
from k3s.
Related Issues (20)
- Use private ip with external cloud manager that doesn't know about that ip
- Allow setting `priorityClassName` on ServiceLB daemonset. HOT 5
- k3s cluster should use GPU without mentioning runtimeClassName: "nvidia" in pod specs HOT 3
- Fail to run static pod without master running HOT 2
- --node-external-ip can not add annotate flannel.alpha.coreos.com/public-ip-overwrite HOT 1
- Pods are going into pending state after upgrading from v1.26.12-k3s1 to v1.27.11-k3s1 and v1.28.5-k3s1 (Issue is quite random)
- leader-elected etcd controllers not consistently functional when leader election/lease mismatches occur HOT 4
- Update minio-go to `v7.0.70` or newer HOT 2
- Embedded helm controller does not track owner references properly
- Network policy in dual-stack cluster stops allowing ingress after pod restart HOT 14
- ingresses stop working every now and then HOT 8
- Create a new single node cluster with embedded registry mirror does not work HOT 5
- K3S startup stuck in a deadlock when a KMS provider is configured and the node is rebooted HOT 4
- Expose k3s metrics over http HOT 2
- Capturing K3s metrics over http/https from VM HOT 1
- Agent node IP not replaced with Tailscale VPN IP HOT 7
- Pods not always creating logs HOT 1
- Best practice of setting the cluster name at deployment level HOT 4
- k3s crashes if I do not start the cloud-provider
- sh: 0: cannot open –: No such file
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from k3s.