K0s configuration validation

Does anyone have any experience running k0s on WSL-2 I would be interested in anyone’s experience doing this. When I run

k0s sysinfo | grep -v pass

I see:

  > CONFIG_NETFILTER_XT_MATCH_RECENT: "recent" match support: unknown (warning)
  CONFIG_NF_CONNTRACK_IPV4: IPv4 connection tracking support (required for NAT): unknown (warning)
  CONFIG_NF_NAT_IPV4: IPv4 NAT: unknown (warning)
  CONFIG_NF_CONNTRACK_IPV6: IPv6 connection tracking support (required for NAT): unknown (warning)
  CONFIG_NF_NAT_IPV6: IPv6 NAT: unknown (warning)

Does anyone have any suggestions on how to fix or the best way to debug it?

Does anyone know what effect these issues will have on k0s execution?

Looking at page:

[Configuration Validation - Documentation](https://Configuration validation)

It says to run:

k0s validate config --config path/to/config/file

However when I run:

k0s validate config --config k0s.yaml

I get:

Command “config” is deprecated, use ‘k0s config validate’ instead ERRO[2023-02-19 05:48:09] failed to read config from file: failed to parse config from “/run/k0s/k0s.yaml”: error unmarshaling JSON: while decoding JSON: json: unknown field “apix”

When I run:

k0s config validate -d -c k0s.yaml

I get:

DEBU[2023-02-19 05:52:02] Starting debug server debug_server=“:6060” ERRO[2023-02-19 05:52:02] failed to read config from file: failed to parse config from “/run/k0s/k0s.yaml”: error unmarshaling JSON: while decoding JSON: json: unknown field “apix”

What’s the correct way to validate a config file? I have a config file that is supposed to start traefik but the pod is not loading what’s the best way to debug why not?

These are warnings related to missing kernel modules. As the names imply, all are related to networking (NAT).

Since WSL is a single node setup where all the networking is local anyways, I would lean into saying these should not cause any issues. Not having a personal WSL env to play with, I can’t say for sure though. But I do know people have used k0s in WSL envs succesfully.

For the config related issue, mind to share the entire config file you are using? The error kinda seems like some malformed yaml structures, but can’t be sure without seeing it.

It does not look like lens will let me upload or attach a yaml file what’s the best approach on lens. I was trying to run the config validation tool but as noted above it did not do what I expected, what’s the best way to run validation before install and how to see reported configuration errors after install? vscode did not see any issues with the file.

Maybe just paste it in code snippets

Based on the docs it seemed like k0s allows you to validate a config file before you apply it

k0s config validate -h
Example:
k0s config validate --config path_to_config.yaml

Usage:
k0s config validate [flags]

Flags:
-c, --config string config file, use ‘-’ to read the config from stdin (default “/etc/k0s/k0s.yaml”)
–data-dir string Data Directory for k0s (default: /var/lib/k0s). DO NOT CHANGE for an existing setup, things will break!
-d, --debug Debug logging (default: false)
–debugListenOn string Http listenOn for Debug pprof handler (default “:6060”)
-h, --help help for validate
–status-socket string Full file path to the socket file. (default “/var/lib/k0s/run/status.sock”)
-v, --verbose Verbose logging (default: false)

However, running with debug

k0s config validate -v -d --config k0s.yaml
DEBU[2023-02-21 07:33:42] runtime config found: using /run/k0s/k0s.yaml
DEBU[2023-02-21 07:33:42] Starting debug server debug_server=“:6060”
DEBU[2023-02-21 07:33:42] runtime config found: using /run/k0s/k0s.yaml

It seems like it’s not looking at my config file, some increased verbosity in the output would make it clearer what file its processing and whether there are any errors in the file. Running with -v but not -d it does not generate any output and its not clear what file its processing or whether there are any errors

My config file is

apiVersion: k0s.k0sproject.io/v1beta1
kind: ClusterConfig
metadata:
creationTimestamp: null
name: k0s-westie
spec:
api:
address: 172.19.216.155
k0sApiPort: 9443
port: 6443
sans:
- 172.19.216.155
- 172.17.0.1
- 10.244.0.1
- fe80::215:5dff:fe69:ea13
- fe80::44b0:fdff:feef:cde8
- fe80::2052:88ff:fec6:d796
- fe80::b0f5:95ff:fe4c:def7
tunneledNetworkingMode: false
controllerManager: {}
extensions:
helm:
repositories:
- name: traefik
url: Traefik Charts | charts
- name: bitnami
url: https://charts.bitnami.com/bitnami
charts:
- name: traefik
chartname: traefik/traefik
# traefik 21.1.0 · traefik/traefik (15 Feb, 2023)
version: “21.10”
namespace: default
- name: metallb
chartname: bitnami/metallb
# metallb 4.1.16 · bitnami/bitnami (17 Feb, 2023)
version: “2.5.4”
namespace: default
values: |2
configInline:
address-pools:
- name: generic-cluster-pool
protocol: layer2
addresses:
- 192.168.0.5-192.168.0.10
storage:
create_default_storage_class: false
type: external_storage
images:
calico:
cni:
image: docker.io/calico/cni
version: v3.24.5
kubecontrollers:
image: docker.io/calico/kube-controllers
version: v3.24.5
node:
image: docker.io/calico/node
version: v3.24.5
coredns:
image: docker.io/coredns/coredns
version: 1.10.0
default_pull_policy: IfNotPresent
konnectivity:
image: Quay
version: 0.0.33-k0s
kubeproxy:
image: registry.k8s.io/kube-proxy
version: v1.26.1
kuberouter:
cni:
image: docker.io/cloudnativelabs/kube-router
version: v1.5.1
cniInstaller:
image: Quay
version: 1.1.1-k0s.0
metricsserver:
image: registry.k8s.io/metrics-server/metrics-server
version: v0.6.2
pushgateway:
image: Quay
version: edge@sha256:7031f6bf6c957e2fdb496161fe3bea0a5bde3de800deeba7b2155187196ecbd9
installConfig:
users:
etcdUser: etcd
kineUser: kube-apiserver
konnectivityUser: konnectivity-server
kubeAPIserverUser: kube-apiserver
kubeSchedulerUser: kube-scheduler
konnectivity:
adminPort: 8133
agentPort: 8132
network:
calico: null
clusterDomain: cluster.local
dualStack: {}
kubeProxy:
iptables:
masqueradeAll: true
minSyncPeriod: 0s
syncPeriod: 0s
ipvs:
minSyncPeriod: 0s
syncPeriod: 0s
tcpFinTimeout: 0s
tcpTimeout: 0s
udpTimeout: 0s
metricsBindAddress: 0.0.0.0:10249
mode: iptables
kuberouter:
autoMTU: true
hairpin: Enabled
ipMasq: false
metricsPort: 8080
mtu: 0
peerRouterASNs: “”
peerRouterIPs: “”
nodeLocalLoadBalancing:
envoyProxy:
apiServerBindPort: 7443
image:
image: docker.io/envoyproxy/envoy-distroless
version: v1.24.1
konnectivityServerBindPort: 7132
type: EnvoyProxy
podCIDR: 10.244.0.0/16
provider: kuberouter
serviceCIDR: 10.96.0.0/12
scheduler: {}
storage:
etcd:
externalCluster: null
peerAddress: 172.19.216.155
type: etcd
telemetry:
enabled: true
status: {}

It seems to be a bug. I made an issue: "k0s config validate" does not use the config flag · Issue #2791 · k0sproject/k0s · GitHub

1 Like