2024-07-17 16:41:42 +00:00
|
|
|
# deployment.yaml
|
|
|
|
apiVersion: apps/v1
|
|
|
|
kind: Deployment
|
|
|
|
metadata:
|
|
|
|
name: k8s-web-status
|
|
|
|
namespace: websites
|
|
|
|
labels:
|
|
|
|
app: web-status
|
|
|
|
spec:
|
|
|
|
replicas: 1
|
|
|
|
selector:
|
|
|
|
matchLabels:
|
|
|
|
app: web-status
|
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
labels:
|
|
|
|
app: web-status
|
|
|
|
spec:
|
|
|
|
serviceAccountName: web-status-sa
|
|
|
|
containers:
|
|
|
|
- name: web-status
|
2024-07-18 13:59:29 +00:00
|
|
|
image: registry.leafdev.top/leaf/go-k8s-deployment-status:v0.0.2
|
2024-07-17 16:41:42 +00:00
|
|
|
imagePullPolicy: Always
|
|
|
|
ports:
|
|
|
|
- containerPort: 8080
|
|
|
|
env:
|
|
|
|
- name: KUBERNETES_SERVICE_HOST
|
|
|
|
value: "kubernetes.default.svc"
|
|
|
|
- name: KUBERNETES_SERVICE_PORT
|
|
|
|
value: "443"
|
|
|
|
envFrom:
|
|
|
|
- configMapRef:
|
|
|
|
name: web-status-configmap
|
|
|
|
---
|
|
|
|
# configMap.yaml
|
|
|
|
apiVersion: v1
|
|
|
|
kind: ConfigMap
|
|
|
|
metadata:
|
|
|
|
name: web-status-configmap
|
|
|
|
namespace: websites
|
|
|
|
labels:
|
|
|
|
app: web-status
|
|
|
|
data:
|
|
|
|
NAMESPACES: "websites"
|
|
|
|
---
|
|
|
|
# service.yaml
|
|
|
|
apiVersion: v1
|
|
|
|
kind: Service
|
|
|
|
metadata:
|
|
|
|
name: web-status-service
|
|
|
|
namespace: websites
|
|
|
|
spec:
|
|
|
|
selector:
|
|
|
|
app: web-status
|
|
|
|
ports:
|
|
|
|
- protocol: TCP
|
|
|
|
port: 80
|
|
|
|
targetPort: 8080
|
|
|
|
type: ClusterIP
|
|
|
|
---
|
|
|
|
# serviceaccount.yaml
|
|
|
|
apiVersion: v1
|
|
|
|
kind: ServiceAccount
|
|
|
|
metadata:
|
|
|
|
name: web-status-sa
|
|
|
|
namespace: websites
|
|
|
|
---
|
|
|
|
# role.yaml
|
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
|
|
kind: Role
|
|
|
|
metadata:
|
|
|
|
namespace: websites
|
|
|
|
name: web-status-role
|
|
|
|
rules:
|
|
|
|
- apiGroups: ["", "apps", "extensions"]
|
|
|
|
resources: ["deployments"]
|
|
|
|
verbs: ["get", "list"]
|
|
|
|
---
|
|
|
|
# rolebinding.yaml
|
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
|
|
kind: RoleBinding
|
|
|
|
metadata:
|
|
|
|
name: web-status-rb
|
|
|
|
namespace: websites
|
|
|
|
subjects:
|
|
|
|
- kind: ServiceAccount
|
|
|
|
name: web-status-sa
|
|
|
|
namespace: websites
|
|
|
|
roleRef:
|
|
|
|
kind: Role
|
|
|
|
name: web-status-role
|
|
|
|
apiGroup: rbac.authorization.k8s.io
|