[root@master ~]# vi nagios.yml
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nagios-deployment
spec:
replicas: 1
selector:
matchLabels:
app: nagios-core
template:
metadata:
labels:
app: nagios-core
spec:
containers:
- name: nagios-container
image: jasonrivers/nagios
---
apiVersion: v1
kind: Service
metadata:
name: nagios-service
spec:
type: NodePort
selector:
app: nagios-core
ports:
- port: 80
targetPort: 80
nodePort: 30008
[root@master ~]# kubectl apply -f nagios.yml
deployment.apps/nagios-deployment created
service/nagios-service created
[root@master ~]# kubectl get pods
NAME READY STATUS RESTARTS AGE
nagios-deployment-6674945696-qrbgx 1/1 Running 0 2m46s
nginx-deployment-3-5d95ccf78-mvdbq 1/1 Running 0 46m
[root@master ~]# kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 103m
nagios-service NodePort 10.98.92.77 <none> 80:30008/TCP 2m59s
nodeport-service-3 NodePort 10.98.208.182 <none> 80:30502/TCP 47m
[root@master ~]# kubectl exec -it nagios-deployment-6674945696-qrbgx -- /bin/bash
root@nagios-deployment-6674945696-qrbgx:/#
root@nagios-deployment-6674945696-qrbgx:/#
root@nagios-deployment-6674945696-qrbgx:/# htpasswd /opt/nagios/etc/htpasswd.users root
New password: root
Re-type new password: root
Adding password for user root
root@nagios-deployment-6674945696-qrbgx:/#
접속확인
참고
https://www.nbtechsupport.co.in/2021/03/deploy-nagios-on-kubernetes.html
'kubernetes' 카테고리의 다른 글
컨테이너 인프라환경 구축을 위한 쿠버네티스/도커 -2 (0) | 2021.08.31 |
---|---|
컨테이너 인프라환경 구축을 위한 쿠버네티스/도커 -1 (0) | 2021.08.31 |
kubernetes - nagios 설치 (0) | 2021.05.24 |
kubernetes - centos 7 에서 설치 (0) | 2021.05.22 |
kubernetes-centos7 minikube 설치 (0) | 2021.05.21 |