xtruder / nix-kubernetes

Kubernetes deployment manager written in nix (DEPRECATED for https://github.com/xtruder/kubenix)
MIT License
80 stars 4 forks source link

update example/trivial.nix #12

Open redbaron opened 7 years ago

redbaron commented 7 years ago

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

seppeljordan commented 6 years ago

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
roberth commented 6 years ago

I accidentally a PR #16 . Different solution though.