k8s常用yaml-nginx、busybox、mysql
nginx
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: my-nginx
namespace: default
spec:
replicas: 1
template:
metadata:
labels:
run: my-nginx
spec:
containers:
- name: my-nginx
image: nginx
ports:
- containerPort: 80
busybox
apiVersion: v1
kind: Pod
metadata:
name: busybox
namespace: kxyyq4
spec:
containers:
- image: busybox
command:
- sleep
- "3600"
imagePullPolicy: IfNotPresent
name: busybox
restartPolicy: Always
mysql
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
annotations:
fabric8.io/iconUrl: https://raw.githubusercontent.com/docker-library/docs/c408469abbac35ad1e4a50a6618836420eb9502e/mysql/logo.png
labels:
app: mk-mysql
provider: monkeyk
version: "5.6"
group: com.monkeyk
name: mk-mysql
namespace: monkeyk
spec:
replicas: 1
selector:
matchLabels:
app: mk-mysql
provider: monkeyk
group: com.monkeyk
template:
metadata:
annotations:
fabric8.io/iconUrl: https://raw.githubusercontent.com/docker-library/docs/c408469abbac35ad1e4a50a6618836420eb9502e/mysql/logo.png
labels:
app: mk-mysql
provider: monkeyk
group: com.monkeyk
spec:
volumes:
- name: mk-mysql-data
persistentVolumeClaim:
claimName: mk-mysql-data
containers:
- env:
- name: MYSQL_ROOT_PASSWORD
value: "asdewq"
- name: MYSQL_USER
value: "monkeyk"
- name: MYSQL_PASSWORD
value: "asdewq"
image: "mysql:5.6"
imagePullPolicy: IfNotPresent
name: mk-mysql
ports:
- containerPort: 3306
protocol: TCP
name: http
volumeMounts:
- name: mk-mysql-data
mountPath: /var/lib/mysql
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: mk-mysql-data
namespace: monkeyk
annotations:
volume.beta.kubernetes.io/storage-class: standard
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 2Gi
---
apiVersion: v1
kind: Service
metadata:
annotations:
fabric8.io/iconUrl: >-
https://raw.githubusercontent.com/docker-library/docs/c408469abbac35ad1e4a50a6618836420eb9502e/mysql/logo.png
labels:
expose: "true"
app: mk-mysql
group: com.monkeyk
provider: monkeyk
version: '5.6'
name: mk-mysql
namespace: monkeyk
spec:
type: NodePort
ports:
- name: http
port: 80
nodePort: 30802
protocol: TCP
targetPort: 3306
selector:
app: mk-mysql
group: com.monkeyk
provider: monkeyk
---------------------------------------------------------
恐惧是因为努力的还不够,加油 ~~---------------------------------------------