kubernetes/kubernetes · error

kubelet unsupported in this build

Error message

kubelet unsupported in this build

What it means

watchForLockfileContention is a build-tag stub: server_unsupported.go is compiled with `//go:build !linux`, so on non-Linux platforms it always returns this error. The real implementation (inotify-based lock watching) exists only for Linux. This surfaces if lock-file contention watching is requested on a non-Linux build.

Source

Thrown at cmd/kubelet/app/server_unsupported.go:27

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package app

import (
	"context"
	"errors"
)

func watchForLockfileContention(ctx context.Context, path string, done chan struct{}) error {
	return errors.New("kubelet unsupported in this build")
}

func isCgroup2UnifiedMode() bool {
	return false
}

View on GitHub (pinned to b882c60b40)

Solutions

  1. Run kubelet on Linux if you need lock-file contention watching.
  2. Disable --exit-on-lock-contention on non-Linux platforms (the contention feature is Linux/inotify-specific).
  3. For Windows, rely on the Windows service manager / native locking rather than the inotify-based contention watcher.

Example fix

// before — running on macOS with contention enabled
--exit-on-lock-contention=true --lock-file-path=/tmp/kubelet.lock

// after — disable on non-Linux
# (omit --exit-on-lock-contention)
Defensive patterns

Strategy: validation

Validate before calling

// guard the contention watcher to Linux builds only
//go:build linux
func enableLockContention() { /* real inotify impl */ }
// on non-Linux, return an explanatory error rather than calling the stub

Prevention

When it happens

Trigger: Building/running kubelet for a non-Linux OS (e.g. darwin, or a non-Linux target) and enabling --exit-on-lock-contention with a lock path, which calls watchForLockfileContention. The stub cannot use inotify and so errors.

Common situations: Cross-compiling or running kubelet tooling on macOS for local development; a build constraint mismatch; invoking the contention-watch codepath on Windows (Windows has its own server_windows.go but lock contention watching routes to the stub).

Related errors


AI-assisted analysis of kubernetes/kubernetes@b882c60b40 (2026-08-07). Data as JSON: /api/errors/f6314ad7006e8b3b. Report an issue: GitHub.