Skip to content

Kubernetes 1.10.5 is unusable, auth is not working #43395

@kalbasit

Description

@kalbasit

Issue description

Kubernetes, as installed from nixos-unstable, is not usable, kube-dns is in a crash loop and I can't see logs or exec into any container. Helm does not work either because it fails to forward the port.

I have no KUBECONFIG environment variable, nor do I have a ~/.kube/config.

Steps to reproduce

in /etc/nixos/configuration.nix

  services.kubernetes = {
    # I have a SWAP device enabled. The following flag disables the error
    # emitted by kubelet when a swap device is found.
    # After all, this is a laptop machine and the cluster is for dev-only.
    kubelet.extraOpts = "--fail-swap-on=false";
    roles = [ "master" "node" ];
  };

and sudo -i nixos-rebuild test

$ kubectl get nodes
NAME      STATUS    ROLES     AGE       VERSION
cratos    Ready     <none>    7m        v1.10.5

$ kubectl get pods --all-namespaces
NAMESPACE     NAME                        READY     STATUS             RESTARTS   AGE
kube-system   kube-dns-5746ddc44f-kvsrb   1/3       CrashLoopBackOff   9          7m

$ kubectl logs kube-dns-5746ddc44f-kvsrb -n kube-system -c kubedns
error: You must be logged in to the server (the server has asked for the client to provide credentials ( pods/log kube-dns-5746ddc44f-kvsrb))

$ nix-shell -p kubernetes-helm --run 'helm init'
$HELM_HOME has been configured at /home/kalbasit/.helm.

Tiller (the Helm server-side component) has been installed into your Kubernetes Cluster.

Error: forwarding ports: error upgrading connection: unable to upgrade connection: Unauthorized.

What I tried

I have tried to add the admin user to system:masters by the following setting:

  services.kubernetes = {
    # I have a SWAP device enabled. The following flag disables the error
    # emitted by kubelet when a swap device is found.
    # After all, this is a laptop machine and the cluster is for dev-only.
    kubelet.extraOpts = "--fail-swap-on=false";
    roles = [ "master" "node" ];

    apiserver.basicAuthFile = pkgs.writeText "users" ''
      kubernetes,admin,0,"system:masters"
    '';
  };

and add the following contents to ~/.kube/config

apiVersion: v1
clusters:
- cluster:
    insecure-skip-tls-verify: true
    server: https://127.0.0.1
  name: local
contexts:
- context:
    cluster: local
    user: local
  name: local
current-context: local
kind: Config
preferences: {}
users:
- name: local
  user:
    password: kubernetes
    username: admin

But I'm still getting the same error:

$ kube logs kube-dns-5746ddc44f-kvsrb -n kube-system -c dnsmasq
error: You must be logged in to the server (the server has asked for the client to provide credentials ( pods/log kube-dns-5746ddc44f-kvsrb))

Technical details

Please run nix-shell -p nix-info --run "nix-info -m" and paste the
results.

  • system: "x86_64-linux"
  • host os: Linux 4.17.4, NixOS, 18.09pre145679.dae9cf6106d (Jellyfish)
  • multi-user?: yes
  • sandbox: no
  • version: nix-env (Nix) 2.0.4
  • channels(root): "nixos-18.09pre145679.dae9cf6106d"
  • channels(kalbasit): "nixos-18.09pre145524.2a8a5533d18"
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos

relates to:

cc @srhb
cc @johanot

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions