내 3 가상 박스 VM에 kubernetes 클러스터를 설치했습니다. 3 개의 VM 모두 ufw가 비활성화 된 Ubuntu14.04를 실행합니다. Kubernetes versin은 1.6입니다. 여기 포드와 서비스를 만들기위한 설정 파일이 있습니다.Kubernetes 노드 포트를 성공적으로 노출 할 수 없습니다.
포드 pod.yaml
:
apiVersion: v1
kind: ReplicationController
metadata:
name: frontend
labels:
name: frontend
spec:
replicas: 3
selector:
name: frontend
template:
metadata:
labels:
name: frontend
spec:
imagePullSecrets:
- name: regsecret
containers:
- name: frontend
image: hub.allinmoney.com/kubeguide/guestbook-php-frontend
env:
- name: GET_HOSTS_FROM
value: env
ports:
- containerPort: 80
서비스 service.yaml
:
apiVersion: v1
kind: Service
metadata:
name: frontend
labels:
name: frontend
spec:
type: NodePort
ports:
- port: 80
targetPort: 31000
nodePort: 31000
selector:
name: frontend
나는 유형 NodePort
과 서비스를 만들 수 있습니다. 내가 명령 kubectl create -f service.yaml
를 실행하면 아래와 같이 출력하고, 나는 어떤 KUBE 노드에 노출 된 포트 31000 찾을 수 없습니다 :
You have exposed your service on an external port on all nodes in your
cluster. If you want to expose this service to the external internet, you may
need to set up firewall rules for the service port(s) (tcp:31000) to serve traffic.
See http://releases.k8s.io/release-1.3/docs/user-guide/services-firewalls.md for more details.
사람이이 문제를 해결하는 방법을 알려이나 나에게 어떤 조언을 주실 수 있습니까?
targetPort를 80으로 설정해보십시오. – JazzCat
노드에서 kube-system이 실행 중입니까? 'iptables-save'의 출력을 게시 할 수 있습니까? –