k8s yaml
程序员文章站
2024-03-09 09:42:35
...
nginx rc/svc/ingress
apiVersion: v1
kind: ReplicationController
metadata:
name: yangsen-nginx-rc
namespace: default
spec:
replicas: 1
selector:
app: yangsen-nginx
template:
metadata:
labels:
app: yangsen-nginx
spec:
containers:
- name: nginx
image: russmckendrick_cluster:latest
imagePullPolicy: IfNotPresent
livenessProbe:
httpGet:
path: /
port: 80
scheme: HTTP
initialDelaySeconds: 30
periodSeconds: 5
timeoutSeconds: 5
resources:
limits:
cpu: 10m
memory: 20Mi
requests:
cpu: 10m
memory: 20Mi
ports:
- containerPort: 80
protocol: TCP
volumeMounts:
- mountPath: /var/log/nginx
name: yangsen-nginx-logvolume
- mountPath: /etc/localtime
name: localtime
readOnly: true
- name: filebeat
image: docker.elastic.co/beats/filebeat:5.5
imagePullPolicy: IfNotPresent
env:
- name: ES_SERVERS
value: 10.12.0.107:5044
- name: HOST_IP
value: 10.12.0.142
volumeMounts:
- mountPath: /var/log/nginx
name: yangsen-nginx-logvolume
restartPolicy: Always
volumes:
- name: yangsen-nginx-logvolume
emptyDir: {}
- name: localtime
hostPath:
path: /etc/localtime
---
kind: Service
apiVersion: v1
metadata:
labels:
app: yangsen-nginx
name: yangsen-nginx-svc
namespace: default
spec:
ports:
- name: nginx
port: 80
targetPort: 80 #containerPort: 80
nodePort: 30080
protocol: TCP
type: NodePort #type: LoadBalancer,ClusterIP,NodePort,ExternalName
selector:
app: yangsen-nginx
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: yangsen-nginx-ingress
namespace: default
spec:
rules:
- host: nginx.yangsen.com
http:
paths:
- path: /
backend:
serviceName: yangsen-nginx-svc
servicePort: 80
上一篇: centos7 扩容根分区