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

k3s server --kube-apiserver-arg --service-node-port-range=30000-40000 #1261

Closed
szbjb opened this issue Jan 2, 2020 · 9 comments
Closed

k3s server --kube-apiserver-arg --service-node-port-range=30000-40000 #1261

szbjb opened this issue Jan 2, 2020 · 9 comments

Comments

@szbjb
Copy link

szbjb commented Jan 2, 2020

[root@localhost ~]#
[root@localhost ~]# k3s server --kube-apiserver-arg --service-node-port-range=30000-40000
INFO[2020-01-02T10:11:39.463048656+08:00] Starting k3s v1.0.1 (e94a3c60)
INFO[2020-01-02T10:11:39.463464572+08:00] Cluster bootstrap already complete
FATA[2020-01-02T10:11:39.478510983+08:00] starting kubernetes: listen tcp :6443: bind: address already in use
[root@localhost ~]#

@luisbrandao
Copy link

You are calling the server daemon from the console... isn't your server already running via systemd?

@Id2ndR
Copy link

Id2ndR commented Mar 6, 2020

Related to #444
I added this to the k3s (server) service in /etc/systemd/system/k3s.service in the ExecStart:

'--kube-apiserver-arg' 'service-node-port-range=1-65535' \

@ramran-r
Copy link

ramran-r commented Aug 19, 2020

@Id2ndR How do you validate the apiserver argument is updated post adding the above in 'k3s.service'?

@brandond
Copy link
Member

You'll see it in the k3s log output.

@ramran-r
Copy link

@brandond Thanks. I get below details alwaays from this command k3s server --log testlog.txt .

time="2020-08-19T12:41:03.338058611-05:00" level=info msg="Starting k3s v1.18.6+k3s1 (6f56fa1)"
time="2020-08-19T12:41:03.340298043-05:00" level=info msg="Cluster bootstrap already complete"
time="2020-08-19T12:41:03.352787485-05:00" level=fatal msg="starting kubernetes: preparing server: start cluster and https: listen tcp :6443: bind: address already in use"
~

Are there any other arggument should be passed to get complete log details? pls. suggest.

@brandond
Copy link
Member

This most likely means k3s is already running. Did you mean to edit the systemd unit arguments and restart it, instead of running another copy of it from the command line?

@ramran-r
Copy link

I followed below steps and could see the updated arguments value set.
systemctl stop k3s.service
k3s server --kube-apiserver-arg adverties-port=7000 --log newlog.txt

BTW , where does kube-apiserver or kube-controller-manager configurations stored in K3S. How does K3S service understand the new argument values to consider whenever it is restarted?
I know K8S stores them in file system under /etc/kubernetes/manifests/

@ramran-r
Copy link

Seems like a bug ; Followed below steps

  1. systemctl stop k3s.service

  2. k3s server --kube-apiserver-arg advertise-port=7000 --log newlog.txt
    Expected & actual behavior : Argument value is updated with 7000 ( default value is 6443)

  3. Stopped the service and started again.
    Expected behavior : Argument value should be retained with 7000
    Actual behavior : It is reset to default value which is 6443.

Pls. advise.

@brandond
Copy link
Member

brandond commented Aug 19, 2020

Running k3s manually via the command-line with different options doesn't have anything to do with the the systemd unit configuration. You need to edit the actual unit to change the arguments that systemd starts the service with.

Also, don't pass --log when running as a service. Just use journalctl -u k3s to view logs.

systemctl stop k3s
vi /etc/systemd/system/k3s.service  # change your configuration, save and quit
systemctl daemon-reload
systemctl start k3s

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

5 participants