0
我有一個存儲庫與我所有的kubernetes豆莢文件夾,在每個文件夾中我有2個文件,假設我有一個文件夾名稱「MyApp」,文件夾我有:爲什麼我不能看到我所有的kubernetes服務使用「kubectl獲取服務」
controller.yaml
,看起來像這樣:(這是我的RC)
apiVersion: v1
kind: ReplicationController
metadata:
name: MyApp
labels:
name: MyApp
spec:
replicas: 1
selector:
name: MyApp
template:
metadata:
labels:
name: MyApp
version: 0.1.4
spec:
containers:
- name: MyApp
#this is the image artifactory
image: docker-docker-release.someartifactory.com/MyApp:0.1.4
ports:
- containerPort: 9000
imagePullSecrets:
- name: myCompany-artifactory
service.yaml
,看起來像這樣:
apiVersion: v1
kind: Service
metadata:
name: MyApp
labels:
name: MyApp
spec:
# if your cluster supports it, uncomment the following to automatically create
# an external load-balanced IP for the frontend service.
type: LoadBalancer
ports:
# the port that this service should serve on
- port: 9000
selector:
name: MyApp
現在,我跑kubectl get services
列出我的所有服務,我也得到:
NAME LABELS SELECTOR IP(S) PORT(S)
kubernetes component=apiserver,provider=kubernetes <none> xxxxx
爲什麼我沒有得到我所有的服務?
只需檢查一下,您是否運行'kubectl create -f service.yaml'和'kubectl create -f controller.yaml'或者您是如何定義服務/複製控制器的? –