feat: Add --server option to microk8s config for custom hostname (#5270)#5330
Open
Ray0907 wants to merge 1 commit intocanonical:masterfrom
Open
feat: Add --server option to microk8s config for custom hostname (#5270)#5330Ray0907 wants to merge 1 commit intocanonical:masterfrom
Ray0907 wants to merge 1 commit intocanonical:masterfrom
Conversation
Allow users to specify a custom hostname/IP for microk8s config output using --server flag or persistent config file at /args/config-server. Supports IPv4, IPv6 (bracketed), and optional custom port.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Allow users to specify a custom hostname/IP for microk8s config output
using --server flag or persistent config file at
$SNAP_DATA/args/config-server.
Supports IPv4, IPv6 (bracketed), and optional custom port.
Summary
Add
--serveroption tomicrok8s configcommand, allowing users tospecify
a custom hostname or IP address for the cluster server output instead of
manually replacing IPs after each command.
Closes #5270
Changes
-s/--server HOSToption to specify custom hostname or IP addresshost:portformat (e.g.,--server k8s.example.com:6443)--server [::1]:6443)$SNAP_DATA/args/config-serverfile--use-loopbackand--serverare usedtogether
get_default_ipreturns "none"User-facing changes:
--serverflag formicrok8s config$SNAP_DATA/args/config-serverfor persistentsettings
Testing
Manual testing performed:
microk8s config --server hostnameoutputs correct configmicrok8s config --server hostname:portreplaces both hostand port
microk8s config --server [::1]:6443works correctly forIPv6
--serverflag takes precedence over config file--use-loopbackstill works as beforePossible Regressions
None expected. Existing behavior is preserved:
--use-loopbackflag works as beforeChecklist
b/master/CONTRIBUTING.md) page.
form, if you are a
first time contributor.
tests.
Notes
Priority order for server address:
--serverCLI flag (highest)$SNAP_DATA/args/config-serverfile--use-loopbackflagThe cross-node replication mentioned in #5270 is not implemented in this
PR,
as
microk8s configis typically only run on the master node (workernodes
are blocked by clustered.lock). This could be a future enhancement if
needed.