Last active
March 25, 2024 21:31
-
-
Save arnaudoff/fe82e4d131d1dce3917395ec37596c51 to your computer and use it in GitHub Desktop.
k8s demo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 | |
kind: StatefulSet | |
metadata: | |
name: cassandra | |
spec: | |
serviceName: "cassandra" | |
replicas: 3 | |
selector: | |
matchLabels: | |
app: cassandra | |
template: | |
metadata: | |
labels: | |
app: cassandra | |
spec: | |
containers: | |
- name: cassandra | |
image: cassandra:latest | |
ports: | |
- containerPort: 9042 | |
resources: | |
requests: | |
memory: "512Mi" | |
cpu: "250m" | |
volumeMounts: | |
- name: cassandra-data | |
mountPath: /var/lib/cassandra | |
volumeClaimTemplates: | |
- metadata: | |
name: cassandra-data | |
spec: | |
accessModes: ["ReadWriteOnce"] | |
resources: | |
requests: | |
storage: 1Gi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
name: my-configmap | |
namespace: my-namespace | |
data: | |
key1: value1 | |
key2: value2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Secret | |
metadata: | |
name: db-password | |
type: Opaque | |
data: | |
password: BASE64_ENCODED_PASSWORD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: batch/v1 | |
kind: Job | |
metadata: | |
name: example-job | |
spec: | |
template: | |
metadata: | |
name: example-pod | |
spec: | |
containers: | |
- name: example-container | |
image: example-image | |
command: ["echo", "Hello, Kubernetes!"] | |
restartPolicy: Never | |
backoffLimit: 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 | |
kind: StatefulSet | |
metadata: | |
name: mysql | |
spec: | |
serviceName: "mysql" | |
replicas: 1 | |
selector: | |
matchLabels: | |
app: mysql | |
template: | |
metadata: | |
labels: | |
app: mysql | |
spec: | |
containers: | |
- name: mysql | |
image: mysql:latest | |
ports: | |
- containerPort: 3306 | |
env: | |
- name: MYSQL_ROOT_PASSWORD | |
value: "yourpassword" | |
volumeMounts: | |
- name: mysql-persistent-storage | |
mountPath: /var/lib/mysql | |
volumeClaimTemplates: | |
- metadata: | |
name: mysql-persistent-storage | |
spec: | |
accessModes: ["ReadWriteOnce"] | |
resources: | |
requests: | |
storage: 1Gi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: nginx-deployment | |
labels: | |
app: nginx | |
spec: | |
replicas: 3 | |
selector: | |
matchLabels: | |
app: nginx | |
template: | |
metadata: | |
labels: | |
app: nginx | |
spec: | |
containers: | |
- name: nginx | |
image: nginx:latest | |
ports: | |
- containerPort: 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: nginx-pod | |
labels: | |
app: nginx | |
environment: production | |
spec: | |
containers: | |
- name: nginx-container | |
image: nginx:latest | |
ports: | |
- containerPort: 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: PersistentVolumeClaim | |
metadata: | |
name: example-pvc | |
spec: | |
accessModes: | |
- ReadWriteOnce | |
resources: | |
requests: | |
storage: 1Gi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: my-react-app | |
spec: | |
replicas: 3 | |
selector: | |
matchLabels: | |
app: my-react-app | |
template: | |
metadata: | |
labels: | |
app: my-react-app | |
spec: | |
containers: | |
- name: my-react-app | |
image: my-registry/my-react-app:latest | |
ports: | |
- containerPort: 80 | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: my-react-app | |
spec: | |
selector: | |
app: my-react-app | |
ports: | |
- protocol: TCP | |
port: 80 | |
targetPort: 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 | |
kind: StatefulSet | |
metadata: | |
name: redis | |
spec: | |
serviceName: "redis" | |
replicas: 1 | |
selector: | |
matchLabels: | |
app: redis | |
template: | |
metadata: | |
labels: | |
app: redis | |
spec: | |
containers: | |
- name: redis | |
image: redis:latest | |
ports: | |
- containerPort: 6379 | |
volumeMounts: | |
- name: redis-data | |
mountPath: /data | |
volumeClaimTemplates: | |
- metadata: | |
name: redis-data | |
spec: | |
accessModes: ["ReadWriteOnce"] | |
resources: | |
requests: | |
storage: 1Gi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: my-service | |
spec: | |
selector: | |
app: my-app | |
ports: | |
- protocol: TCP | |
port: 80 | |
targetPort: 8080 | |
type: ClusterIP |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment