nix-kubernetes icon indicating copy to clipboard operation
nix-kubernetes copied to clipboard

update example/trivial.nix

Open redbaron opened this issue 7 years ago • 2 comments

I am trying to wrap my head around using nix for kube resources management, having working up-to-date example would really help.

redbaron avatar Sep 05 '17 21:09 redbaron

hey redbaron, i got nix-kubernetes working. I don't know exacly why, but line 3 seems to be faulty. instead provide "-n" flag to "nix-kubernetes deploy" command.

# deployment.nix
{
  default =
    { config, pkgs, lib, ... }:
    with lib;
    {
      kubernetes.namespaces = {
        default = {
          name = "default";
        };
      };
      kubernetes.deployments.redis = {
        replicas = 1;
        pod.containers.redis = {
          image = "redis";
          args = "redis-server --appendonly yes";
          ports = [{ port = 6379; }];
          requests.memory = "128Mi";
          requests.cpu = "50m";
        };
      };
    };
}
[sebastian@laptop:~/svm/src/nixops-machines]$ nix-kubernetes list
┌─────────┬────────────────────────────────────────────────────────┐
│ name    │ path                                                   │
├─────────┼────────────────────────────────────────────────────────┤
│ default │ /home/sebastian/svm/src/nixops-machines/deployment.nix │
└─────────┴────────────────────────────────────────────────────────┘

[sebastian@laptop:~/svm/src/nixops-machines]$ nix-kubernetes deploy -d default -n default
Config: /nix/store/arrbyp0i401f4mssv378manf1ml5bbix-configurations
deploying: Namespace default
deploying: Deployment redis
deployment complete

seppeljordan avatar Sep 12 '17 08:09 seppeljordan

I accidentally a PR #16 . Different solution though.

roberth avatar Mar 05 '18 09:03 roberth