0

私はすべてのkubernetesポッドフォルダを持つリポジトリを持っています。それぞれのフォルダに2つのファイルがあります。私が持っているフォルダ:(これは私のRCです)なぜ私はkubectlサービスを利用して私のkubernetesサービスを見ることができないのですか

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次のようになりますよう:次のようになります

controller.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 

、私はを実行します私のすべてのサービスを一覧表示し、私が取得する:

NAME   LABELS         SELECTOR IP(S)  PORT(S) 
kubernetes component=apiserver,provider=kubernetes <none>  xxxxx 

は、なぜ私は私が持っているすべてのサービスを得ることはありませんか?

+0

あなたは 'kubectl create -f service.yaml'と' kubectl create -f controller.yaml'を実行したか、サービス/複製コントローラをどのように定義しましたか? –

答えて

1

あなたは1つのサービス、および1 ReplicationController

あなたは両方を作成する最初の必要があります。

kubectl create -f service.yaml

kubectl create -f controller.yaml

のThをアンと:

kubectl get servicesはサービス

kubectl get rc

kubectl get podsがReplicationControllerによって展開ポッドを示しReplicationControllersをそれぞれ示します。

関連する問題