Я создал докер местного установку kubernetes, и я смог создать реплики и услуги, как показано ниже (это от kubernetes 201):Как я могу открыть службу в узле в kubernetes 1.0?
гс:
apiVersion: v1
kind: ReplicationController
metadata:
name: nginx-controller
spec:
replicas: 2
# selector identifies the set of Pods that this
# replication controller is responsible for managing
selector:
app: nginx
# podTemplate defines the 'cookie cutter' used for creating
# new pods when necessary
template:
metadata:
labels:
# Important: these labels need to match the selector above
# The api server enforces this constraint.
app: nginx
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort: 80
и service.yaml:
apiVersion: v1
kind: Service
metadata:
name: nginx-service
spec:
ports:
- port: 8000 # the port that this service should serve on
# the container on each pod to connect to, can be a name
# (e.g. 'www') or a number (e.g. 80)
targetPort: 80
protocol: TCP
nodePort: 30000
type: LoadBalancer
# just like the selector in the replication controller,
# but this time it identifies the set of pods to load balance
# traffic to.
selector:
app: nginx
С моей точки зрения, я должен иметь доступ к службе из порта 30000 в узле, но все, что я получаю, это пустой ответ. Любая помощь?
Ну, он работает с привилегированными = верно, так оно должно иметь права суперпользователя. Я попробую это, но заметьте, что это может быть обходным путем. В идеале это должно быть разрешено на «уровне обслуживания». –