kubectl exposes codex on 30001

This commit is contained in:
benbierens 2023-03-17 10:05:00 +01:00
commit cc87359a73
No known key found for this signature in database
GPG Key ID: FE44815D96D0A1AA
4 changed files with 123 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
.vs
obj
bin

32
Program.cs Normal file
View File

@ -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.");
}
}

73
codexnode-manifest.yml Normal file
View File

@ -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

15
cs-kubetry.csproj Normal file
View File

@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>cs_kubetry</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="KubernetesClient" Version="10.1.4" />
</ItemGroup>
</Project>