Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guides: Add simplified K8s manifests #41

Merged
merged 10 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions k8s/api.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Deployment
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
io.kompose.service: api
name: api
spec:
replicas: 1
selector:
matchLabels:
io.kompose.service: api
template:
metadata:
annotations:
kompose.cmd: kompose convert -f docker-compose.yaml
kompose.version: 1.34.0 (HEAD)
labels:
io.kompose.service: api
spec:
containers:
- env:
- name: COLLECTOR_ENDPOINT
value: http://otel-collector.default.svc.cluster.local:4317
- name: DATABASE_URL
value: postgresql://ashketchum:squirtle123@db:5432/pokeshop?schema=public
- name: POKE_API_BASE_URL
value: https://pokeapi.co/api/v2
- name: RABBITMQ_HOST
value: guest:guest@queue
- name: REDIS_URL
value: cache
image: kubeshop/demo-pokemon-api:latest
imagePullPolicy: Always
livenessProbe:
exec:
command:
- wget
- --spider
- localhost:8081/pokemon/healthcheck
failureThreshold: 60
periodSeconds: 1
timeoutSeconds: 3
name: api
ports:
- containerPort: 8081
protocol: TCP
restartPolicy: Always

# Service
---
apiVersion: v1
kind: Service
metadata:
labels:
io.kompose.service: api
name: api
spec:
ports:
- name: "8081"
port: 8081
targetPort: 8081
selector:
io.kompose.service: api
49 changes: 49 additions & 0 deletions k8s/cache.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Deployment
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
io.kompose.service: cache
name: cache
spec:
replicas: 1
selector:
matchLabels:
io.kompose.service: cache
template:
metadata:
labels:
io.kompose.service: cache
spec:
containers:
- image: redis:6
livenessProbe:
exec:
command:
- redis-cli
- ping
failureThreshold: 60
periodSeconds: 1
timeoutSeconds: 3
name: cache
ports:
- containerPort: 6379
protocol: TCP
restartPolicy: Always

# Service
---
apiVersion: v1
kind: Service
metadata:
labels:
io.kompose.service: cache
name: cache
spec:
ports:
- name: "6379"
port: 6379
targetPort: 6379
selector:
io.kompose.service: cache
89 changes: 89 additions & 0 deletions k8s/db.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Deployment
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
io.kompose.service: db
name: db
spec:
replicas: 1
selector:
matchLabels:
io.kompose.service: db
template:
metadata:
labels:
io.kompose.service: db
spec:
containers:
- env:
- name: POSTGRES_DB
value: pokeshop
- name: POSTGRES_PASSWORD
value: squirtle123
- name: POSTGRES_USER
value: ashketchum
image: postgres:14
name: db
ports:
- containerPort: 5432
protocol: TCP
volumeMounts:
- mountPath: /var/lib/postgresql/data
name: dbdata
volumes:
- name: dbdata
persistentVolumeClaim:
claimName: db-volume-claim
restartPolicy: Always

# Service
---
apiVersion: v1
kind: Service
metadata:
labels:
io.kompose.service: db
name: db
spec:
ports:
- name: "5432"
port: 5432
targetPort: 5432
selector:
io.kompose.service: db

# Persistent Volume
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: db-volume
labels:
type: local
io.kompose.service: db
spec:
storageClassName: manual
capacity:
storage: 10Gi
accessModes:
- ReadWriteMany
hostPath:
path: /data/postgresql

# Persistent Volume Claim
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: db-volume-claim
labels:
io.kompose.service: db
spec:
storageClassName: manual
accessModes:
- ReadWriteMany
resources:
requests:
storage: 10Gi
70 changes: 70 additions & 0 deletions k8s/jaeger.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Deployment
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
io.kompose.service: jaeger
name: jaeger
spec:
replicas: 1
selector:
matchLabels:
io.kompose.service: jaeger
template:
metadata:
labels:
io.kompose.service: jaeger
spec:
containers:
- env:
- name: COLLECTOR_OTLP_ENABLED
value: "true"
- name: COLLECTOR_ZIPKIN_HOST_PORT
value: :9411
image: jaegertracing/all-in-one:latest
livenessProbe:
exec:
command:
- wget
- --spider
- localhost:16686
failureThreshold: 60
periodSeconds: 1
timeoutSeconds: 3
name: jaeger
ports:
- containerPort: 4317
protocol: TCP
- containerPort: 14250
protocol: TCP
- containerPort: 16685
protocol: TCP
- containerPort: 16686
protocol: TCP
restartPolicy: Always

# Service
---
apiVersion: v1
kind: Service
metadata:
labels:
io.kompose.service: jaeger
name: jaeger
spec:
ports:
- name: "4317"
port: 4317
targetPort: 4317
- name: "14250"
port: 14250
targetPort: 14250
- name: "16685"
port: 16685
targetPort: 16685
- name: "16686"
port: 16686
targetPort: 16686
selector:
io.kompose.service: jaeger
119 changes: 119 additions & 0 deletions k8s/otel-collector.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# Deployment
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
io.kompose.service: otel-collector
name: otel-collector
spec:
replicas: 1
selector:
matchLabels:
io.kompose.service: otel-collector
strategy:
type: Recreate
template:
metadata:
labels:
io.kompose.service: otel-collector
spec:
containers:
- args:
- --config
- /config/otel-local-config.yaml
env:
- name: JAEGER_ENDPOINT
value: jaeger.default.svc.cluster.local:4317
- name: TRACETEST_AGENT_ENDPOINT
value: tracetest-agent.default.svc.cluster.local:4317
image: otel/opentelemetry-collector-contrib:0.107.0
name: otel-collector
ports:
- containerPort: 55679
protocol: TCP
- containerPort: 8888
protocol: TCP
- containerPort: 4317
protocol: TCP
- containerPort: 4318
protocol: TCP
volumeMounts:
- mountPath: /config
name: otel-collector-cm0
restartPolicy: Always
volumes:
- configMap:
items:
- key: collector.config.yaml
path: otel-local-config.yaml
name: otel-collector-cm0
name: otel-collector-cm0

# Service
---
apiVersion: v1
kind: Service
metadata:
labels:
io.kompose.service: otel-collector
name: otel-collector
spec:
ports:
- name: "55679"
port: 55679
targetPort: 55679
- name: "8888"
port: 8888
targetPort: 8888
- name: "4317"
port: 4317
targetPort: 4317
- name: "4318"
port: 4318
targetPort: 4318
selector:
io.kompose.service: otel-collector

# ConfigMap
---
apiVersion: v1
data:
collector.config.yaml: |
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
http:
endpoint: 0.0.0.0:4318
processors:
batch:
exporters:
logging:
loglevel: debug
otlp/jaeger:
endpoint: ${JAEGER_ENDPOINT}
tls:
insecure: true
otlp/tracetest:
endpoint: ${TRACETEST_AGENT_ENDPOINT}
tls:
insecure: true
service:
pipelines:
traces/jaeger:
receivers: [otlp]
processors: []
exporters: [logging, otlp/jaeger]
traces/tracetest:
receivers: [otlp]
processors: [batch]
exporters: [otlp/tracetest]
kind: ConfigMap
metadata:
annotations:
use-subpath: "true"
labels:
io.kompose.service: otel-collector
name: otel-collector-cm0
Loading
Loading