Skip to content

Instantly share code, notes, and snippets.

@mddamato
Last active May 2, 2023 23:27
Show Gist options
  • Save mddamato/52f8c0ad511c0bad199186c47bd5c899 to your computer and use it in GitHub Desktop.
Save mddamato/52f8c0ad511c0bad199186c47bd5c899 to your computer and use it in GitHub Desktop.
registry and file server
apiVersion: apps/v1
kind: Deployment
metadata:
name: fileserver
labels:
app: fileserver
spec:
replicas: 1
selector:
matchLabels:
app: fileserver
template:
metadata:
labels:
app: fileserver
spec:
volumes:
- name: files
hostPath:
path: /var/lib/rancher/yum_repos/rke_rpm_deps
type: Directory
containers:
- name: fileserver
image: docker.io/library/httpd:2.4.54
imagePullPolicy: IfNotPresent
ports:
- containerPort: 80
volumeMounts:
- name: files
mountPath: "/usr/local/apache2/htdocs/"
---
apiVersion: v1
kind: Service
metadata:
namespace: default
name: fileserver
spec:
selector:
app: fileserver
type: NodePort
ports:
- port: 80
targetPort: 80
nodePort: 30002
---
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: default
name: registry
labels:
app: registry
spec:
replicas: 1
selector:
matchLabels:
app: registry
template:
metadata:
labels:
app: registry
spec:
volumes:
- name: registry-data
hostPath:
path: /var/lib/rancher/registry
type: Directory
- name: certs
secret:
secretName: registry-default-com-tls
containers:
- name: registry
env:
- name: REGISTRY_HTTP_TLS_CERTIFICATE
value: "/certs/tls.crt"
- name: REGISTRY_HTTP_TLS_KEY
value: "/certs/tls.key"
# - name: REGISTRY_HTTP_ADDR
# value: "443"
image: docker.io/library/registry:2
imagePullPolicy: Never
ports:
- containerPort: 5000
volumeMounts:
- name: registry-data
mountPath: /var/lib/registry
- name: certs
mountPath: /certs
---
apiVersion: v1
kind: Service
metadata:
namespace: default
name: registry
spec:
selector:
app: registry
type: NodePort
ports:
- port: 5000
targetPort: 5000
nodePort: 30001
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: registry-registry-com
namespace: default
spec:
secretName: registry-default-com-tls
duration: 8760h
renewBefore: 360h
subject:
organizations:
- RGS-Mega-Corporation
commonName: registry.default.svc.cluster.local
isCA: false
privateKey:
algorithm: ECDSA
size: 521
usages:
- server auth
- client auth
dnsNames:
- registry.default.com
- registry.default.svc.cluster.local
- www.registry.default.com
- ${SERVER_HOSTNAME}
ipAddresses:
- ${SERVER_IP}
issuerRef:
name: cluster-issuer
kind: ClusterIssuer
group: cert-manager.io
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment