From cc87359a73f762decc9b96177bbe451228bda31b Mon Sep 17 00:00:00 2001 From: benbierens Date: Fri, 17 Mar 2023 10:05:00 +0100 Subject: [PATCH] kubectl exposes codex on 30001 --- .gitignore | 3 ++ Program.cs | 32 ++++++++++++++++++ codexnode-manifest.yml | 73 ++++++++++++++++++++++++++++++++++++++++++ cs-kubetry.csproj | 15 +++++++++ 4 files changed, 123 insertions(+) create mode 100644 .gitignore create mode 100644 Program.cs create mode 100644 codexnode-manifest.yml create mode 100644 cs-kubetry.csproj diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..63bc327 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.vs +obj +bin diff --git a/Program.cs b/Program.cs new file mode 100644 index 0000000..4ac4eb8 --- /dev/null +++ b/Program.cs @@ -0,0 +1,32 @@ +using k8s; + +public static class Program +{ + public static void Main(string[] args) + { + Console.WriteLine("Hello, World!"); + + var config = KubernetesClientConfiguration.BuildConfigFromConfigFile(); + + var client = new Kubernetes(config); + + var namespaces = client.CoreV1.ListNamespace(); + foreach (var ns in namespaces.Items) + { + Console.WriteLine(ns.Metadata.Name); + var list = client.CoreV1.ListNamespacedPod(ns.Metadata.Name); + foreach (var item in list.Items) + { + Console.WriteLine(item.Metadata.Name); + } + } + + var services = client.CoreV1.ListServiceForAllNamespaces(); + foreach (var service in services) + { + Console.WriteLine($"service: {service.Metadata.Name}"); + } + + Console.WriteLine("Done."); + } +} diff --git a/codexnode-manifest.yml b/codexnode-manifest.yml new file mode 100644 index 0000000..6d86e7f --- /dev/null +++ b/codexnode-manifest.yml @@ -0,0 +1,73 @@ +# apiVersion: v1 +# kind: Pod +# metadata: +# name: codex-pod +# spec: +# containers: +# - name: codex-node-container +# image: thatbenbierens/nim-codex:sha-c9a62de +# ports: +# - containerPort: 8080 + +# kind: PersistentVolumeClaim +# apiVersion: v1 +# metadata: +# name: codex-vol +# spec: +# accessModes: +# - ReadWriteOnce +# resources: +# requests: +# storage: 1Gi +# storageClassName: rbd + +# --- + +apiVersion: apps/v1 +kind: Deployment +metadata: + name: codex-demo + namespace: default +spec: + replicas: 1 + selector: + matchLabels: + codex-node: dist-test + template: + metadata: + labels: + codex-node: dist-test + spec: + containers: + - name: codex-node + image: thatbenbierens/nim-codex:sha-c9a62de + ports: + - containerPort: 8080 + name: codex-api-port + # hostPort: 8080 + env: + - name: LOG_LEVEL + value: WARN + # volumeMounts: + # - mountPath: /datadir + # name: codex-data + # volumes: + # - name: codex-data + # persistentVolumeClaim: + # claimName: codex-vol +--- + +apiVersion: v1 +kind: Service +metadata: + name: codex-entrypoint + namespace: default +spec: + type: NodePort + selector: + codex-node: dist-test + ports: + - protocol: TCP + port: 8080 + targetPort: codex-api-port + nodePort: 30001 diff --git a/cs-kubetry.csproj b/cs-kubetry.csproj new file mode 100644 index 0000000..d6707ed --- /dev/null +++ b/cs-kubetry.csproj @@ -0,0 +1,15 @@ + + + + Exe + net6.0 + cs_kubetry + enable + enable + + + + + + +