Bug 1320339 - [DOCS] example YAML files have a number of invalid fields in "Atomic Host 7 Getting Started with Containers"
Summary: [DOCS] example YAML files have a number of invalid fields in "Atomic Host 7 G...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: doc-RHEL-Atomic
Version: 7.2
Hardware: Unspecified
OS: Unspecified
urgent
high
Target Milestone: rc
: ---
Assignee: Chris Negus
QA Contact: Vikram Goyal
Vikram Goyal
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-03-22 21:41 UTC by Micah Abbott
Modified: 2019-03-06 00:43 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1322121 1322123 (view as bug list)
Environment:
Last Closed: 2016-03-25 13:45:14 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Micah Abbott 2016-03-22 21:41:42 UTC
In section 3.7 "Launching Services, Replication Controllers, and Container Pods with Kubernetes", the example YAML files have a number of invalid fields for the v1 API of Kubernetes.

Below is what happens when you try to use them using the 7.2.2.-2 version of RHEALAH.


# atomic host status
  TIMESTAMP (UTC)         VERSION     ID             OSNAME               REFSPEC                                                        
* 2016-03-01 01:35:21     7.2.2-2     8b2cf24b42     rhel-atomic-host     rhel-atomic-host-ostree:rhel-atomic-host/7/x86_64/standard     

# cat db-rc.yaml 
---
kind: ReplicationController
apiVersion: v1
metadata:
   name: db-controller
spec:
  replicas: 2
  selector:
    name: db
  template:
    spec:
      containers:
      - name: db
        image: dbforweb
        ports:
          - containerPort: 3306
    metadata:
      labels:
        name: "db"
      selectorname: "db"
  labels:
    name: "db"

# kubectl create -f db-rc.yaml 
error validating "db-rc.yaml": error validating data: [found invalid field selectorname for v1.ObjectMeta, found invalid field labels for v1.ReplicationControllerSpec]; if you choose to ignore these errors, turn
 validation off with --validate=false

# cat webserver-service.yaml 
---
apiVersion: v1
kind: Service
metadata:
  labels:
    name: webserver
  name: webserver-service
  namespace: default
spec:
  ports:
  - port: 80
  publicIPs:
  - 192.168.122.182
  selector:
    name: webserver

 kubectl create -f webserver-service.yaml 
error validating "webserver-service.yaml": error validating data: found invalid field publicIPs for v1.ServiceSpec; if you choose to ignore these errors, turn validation off with --validate=false

# cat webserver-rc.yaml 
---
apiVersion: v1
kind: ReplicationController
metadata:
  name: webserver-controller
spec:
  replicas: 2
  selector:
    name: webserver
  template:
    spec:
      containers:
        - name: apache-frontend
          image: webwithdb
          ports:
            - containerPort: 80
    metadata:
      labels:
        name: webserver
        uses: db
  labels:
    name: "webserver"

# kubectl create -f webserver-rc.yaml 
error validating "webserver-rc.yaml": error validating data: found invalid field labels for v1.ReplicationControllerSpec; if you choose to ignore these errors, turn validation off with --validate=false

Comment 2 Chris Negus 2016-03-24 04:02:32 UTC
I've corrected the three files and prepared the chapter for publishing. I'll comment again when the new chapter is published. I corrected the db-rc.yaml file as follows:

-------
apiVersion: v1
kind: ReplicationController
metadata:
  name: db-controller
  labels:
    app: db
spec:
  replicas: 2
  selector:
    app: "db"
  template:
    metadata:
      labels:
        app: "db"
    spec:
      containers:
      - name: "db"
        image: "dbforweb"
        ports:
        - containerPort: 3306
-------

I corrected the webserver-service.yaml file to not use a specific IP address:

-------
apiVersion: v1
kind: Service
metadata:
  labels:
    name: webserver
  name: webserver-service
  namespace: default
spec:
  ports:
  - port: 80
  selector:
    name: webserver
-------

I corrected the webserver-rc.yaml file as follows:

-------
kind: "ReplicationController"
apiVersion: "v1"
metadata:
  name: "webserver-controller"
spec:
  replicas: 2
  selector:
    name: "webserver"
  template:
    spec:
      containers:
        - name: "apache-frontend"
          image: "webwithdb"
          ports:
            - containerPort: 80
    metadata:
      labels:
        name: "webserver"
        uses: db
-------

Please try the service and two replication controllers again using the updated yaml files.

Comment 5 Micah Abbott 2016-03-24 17:28:56 UTC
I tested the modified YAML files and they work with with 'kubectl'

However, I'm re-opening the bug because the link to the docs still shows the old YAML files for me (checked via two browsers).

Comment 7 Micah Abbott 2016-03-25 13:34:32 UTC
Looks good now!


Note You need to log in before you can comment on or make changes to this bug.