origin icon indicating copy to clipboard operation
origin copied to clipboard

subdomain change in master-config.yaml doesn't work

Open kenk667 opened this issue 10 years ago • 18 comments

[provide a description of the issue]

Version 1.3.1

[provide output of the openshift version or oc version command]

Steps To Reproduce

Docker Installation: Add Docker repo: cat > /etc/yum.repos.d/docker.repo << 'EOF' [docker] name=Docker Repository baseurl=https://yum.dockerproject.org/repo/main/centos/7/ enabled=1 gpgcheck=1 gpgkey=https://yum.dockerproject.org/gpg EOF

Install Docker engine: yum -y install docker-engine wget git

Enable & start Docker service: systemctl enable docker.service systemctl start docker Openshift Installation:

Stage binary location & download binary: mkdir /opt/openshift/v1.3 chmod 755 /opt /opt/openshift/v1.3 cd /opt/openshift/v1.3 wget https://github.com/openshift/origin/releases/download/v1.3.1/openshift-origin-server-v1.3.1-dad658de7465ba8a234a4fb40b5b446a45a4cee1-linux-64bit.tar.gz tar -zxvf openshift-origin-server-.tar.gz --strip-components 1 rm -f openshift-origin-server-.tar.gz

Create environment script and execute: cat > /etc/profile.d/openshift.sh << 'EOF' export OPENSHIFT=/opt/openshift/v1.3 export OPENSHIFT_VERSION=v1.3.0 export PATH=$OPENSHIFT:$PATH export KUBECONFIG=$OPENSHIFT/openshift.local.config/master/admin.kubeconfig export CURL_CA_BUNDLE=$OPENSHIFT/openshift.local.config/master/ca.crt EOF

chmod 755 /etc/profile.d/openshift.sh . /etc/profile.d/openshift.sh

Stage Openshift Docker images: docker pull openshift/origin-pod:$OPENSHIFT_VERSION docker pull openshift/origin-sti-builder:$OPENSHIFT_VERSION docker pull openshift/origin-docker-builder:$OPENSHIFT_VERSION docker pull openshift/origin-deployer:$OPENSHIFT_VERSION docker pull openshift/origin-docker-registry:$OPENSHIFT_VERSION docker pull openshift/origin-haproxy-router:$OPENSHIFT_VERSION

Create Openshift config files: ./openshift start --write-config=openshift.local.config chmod +r $OPENSHIFT/openshift.local.config/master/admin.kubeconfig chmod +r $OPENSHIFT/openshift.local.config/master/openshift-registry.kubeconfig chmod +r $OPENSHIFT/openshift.local.config/master/openshift-router.kubeconfig

Change routing subdomain: sed -i 's/router.default.svc.cluster.local/SUBDOMAIN.NAME/'
$OPENSHIFT/openshift.local.config/master/master-config.yaml

*change SUBDOMAIN.NAME to appropriate subdomain name. Test with the command below, the return should show your SUBDOMAIN.NAME cat $OPENSHIFT/openshift.local.config/master/master-config.yaml | grep subdomain:

Open firewall ports: firewall-cmd --permanent --zone=public --add-port=80/tcp firewall-cmd --permanent --zone=public --add-port=443/tcp firewall-cmd --permanent --zone=public --add-port=8443/tcp firewall-cmd --reload

Create Openshift service file: Binary installation of Openshift doesn't install as a service and a config file will need to be created.

cat > /etc/systemd/system/openshift-origin.service << 'EOF' [Unit] Description=Origin Master Service After=docker.service Requires=docker.service

[Service] Restart=always RestartSec=10s ExecStart=/opt/openshift/v1.3/openshift start WorkingDirectory=/opt/openshift/v1.3

[Install] WantedBy=multi-user.target EOF

Reload damon and persistently start Openshift service: systemctl daemon-reload systemctl enable openshift-origin systemctl start openshift-origin

Check if service has successfully started by running systemctl status openshift-origin

Add accounts/roles: oadm policy add-cluster-role-to-user cluster-admin admin oadm policy add-cluster-role-to-user admin admin oadm policy add-cluster-role-to-user admin admin

Install integrated registry: mkdir /opt/openshift-registry chcon -Rt svirt_sandbox_file_t /opt/openshift-registry chown 1001.root /opt/openshift-registry oadm policy add-scc-to-user privileged -z registry oadm registry --service-account=registry --mount-host=/opt/openshift-registry Test registry with oc get svc docker-registry command which should return a docker-registry with a cluster IP, default port 5000 and age/uptime count.

Setup Openshift router: oadm policy add-scc-to-user hostnetwork -z router oadm router router --replicas=1 --service-account=router Test with oc status command and in the output svc/router should be listed.

Deploy default image streams: These are the default images that Openshift Enterprise would come with such as NodeJS cartridge. cd ~ git clone https://github.com/openshift/openshift-ansible.git cd openshift-ansible/roles/openshift_examples/files/examples/latest/ for f in image-streams/image-streams-centos7.json; do cat $f | oc create -n openshift -f -; done for f in db-templates/.json; do cat $f | oc create -n openshift -f -; done for f in quickstart-templates/.json; do cat $f | oc create -n openshift -f -; done for f in xpaas-templates/*.json; do cat $f | oc create -n openshift -f -; done

From UI create new project 'test' and add project 'eap70-postgresql-persistent-s2i' and leave hostname blank, the default behavior should be to create a route with ${name}-${namespace}.CUSTOM.SUBDOMAIN

check project page and see if route default is 'appname'-'project name'.CUSTOM.SUBDOMAIN

Current Result

No matter how often I restart openshift service the change isn't recognized from master-config.yaml and the default route remains appname-projectname.router.default.svc.cluster.local

Expected Result

With the change in master-config.yaml under subdomain default route should become appname-projectname.CUSTOM.SUBDOMAIN

Additional Information

[try to run $ oadm diagnostics command if possible]

[root@-----]# oadm diagnostics [Note] Determining if client configuration exists for client/cluster diagnostics Info: Successfully read a client config file at '/opt/openshift/v1.3.1/openshift.local.config/master/admin.kubeconfig' Info: Using context for cluster-admin access: 'default/10-206-73-131:8443/system:admin'

[Note] Running diagnostic: ConfigContexts[default/10-206-73-131:8443/system:admin] Description: Validate client config context is complete and has connectivity

Info: The current client config context is 'default/10-206-73-131:8443/system:admin': The server URL is 'https://10.206.73.131:8443' The user authentication is 'system:admin/10-206-73-131:8443' The current project is 'default' Successfully requested project list; has access to project(s): [default kube-system openshift openshift-infra test2]

[Note] Running diagnostic: DiagnosticPod Description: Create a pod to run diagnostics from the application standpoint

ERROR: [DCli2012 from diagnostic DiagnosticPod@openshift/origin/pkg/diagnostics/client/run_diagnostics_pod.go:155] See the errors below in the output from the diagnostic pod: [Note] Running diagnostic: PodCheckAuth Description: Check that service account credentials authenticate as expected

   ERROR: [DP1003 from diagnostic PodCheckAuth@openshift/origin/pkg/diagnostics/pod/auth.go:88]
          Could not authenticate to the master with the service account credentials: Get https://kubernetes.default.svc.cluster.local:443/oapi/v1/users/~: dial tcp: lookup kubernetes.default.svc.cluster.local: no such host

   ERROR: [DP1016 from diagnostic PodCheckAuth@openshift/origin/pkg/diagnostics/pod/auth.go:113]
          DNS resolution for registry address docker-registry.default.svc.cluster.local returned an error; container DNS is likely incorrect. The error was: read udp 172.17.0.2:36228->10.206.73.131:53: read: no route to host

   [Note] Running diagnostic: PodCheckDns
          Description: Check that DNS within a pod works as expected

   ERROR: [DP2003 from diagnostic PodCheckDns@openshift/origin/pkg/diagnostics/pod/dns.go:72]
          The first /etc/resolv.conf nameserver 10.206.73.131
          could not resolve kubernetes.default.svc.cluster.local.
          Error: read udp 172.17.0.2:44199->10.206.73.131:53: read: no route to host
          This nameserver points to the master's SkyDNS which is critical for
          resolving cluster names, e.g. for Services.

   WARN:  [DP2014 from diagnostic PodCheckDns@openshift/origin/pkg/diagnostics/pod/dns.go:119]
          A request to the nameserver 10.206.73.131 timed out.
          This could be temporary but could also indicate network or DNS problems.

   WARN:  [DP2015 from diagnostic PodCheckDns@openshift/origin/pkg/diagnostics/pod/dns.go:124]
          Error querying nameserver 10.206.73.131:
            read udp 172.17.0.2:51254->10.206.73.131:53: read: no route to host
          This may indicate a problem with DNS.

   [Note] Summary of diagnostics execution (version v1.3.1):
   [Note] Warnings seen: 2
   [Note] Errors seen: 3

[Note] Running diagnostic: ClusterRegistry Description: Check that there is a working Docker registry

[Note] Running diagnostic: ClusterRoleBindings Description: Check that the default ClusterRoleBindings are present and contain the expected subjects

Info: clusterrolebinding/cluster-admins has more subjects than expected.

   Use the `oadm policy reconcile-cluster-role-bindings` command to update the role binding to remove extra subjects.

Info: clusterrolebinding/cluster-admins has extra subject {User admin }.

[Note] Running diagnostic: ClusterRoles Description: Check that the default ClusterRoles are present and contain the expected permissions

[Note] Running diagnostic: ClusterRouterName Description: Check there is a working router

[Note] Running diagnostic: MasterNode Description: Check if master is also running node (for Open vSwitch)

Info: Found a node with same IP as master: osorigin.CUSTOM.DOMAIN

[Note] Skipping diagnostic: MetricsApiProxy Description: Check the integrated heapster metrics can be reached via the API proxy Because: The heapster service does not exist in the openshift-infra project at this time, so it is not available for the Horizontal Pod Autoscaler to use as a source of metrics.

[Note] Running diagnostic: NodeDefinitions Description: Check node records on master

[Note] Skipping diagnostic: ServiceExternalIPs Description: Check for existing services with ExternalIPs that are disallowed by master config Because: No master config file was detected

[Note] Summary of diagnostics execution (version v1.3.1): [Note] Errors seen: 1

[if you are reporting issue related to builds, provide build logs with BUILD_LOGLEVEL=5] [consider attaching output of the $ oc get all -o json -n <namespace> command to the issue]

kenk667 avatar Oct 26 '16 17:10 kenk667

the configured subdomain is placed into the route at creation time

liggitt avatar Oct 26 '16 17:10 liggitt

@liggitt

at creation time of the eap app? if that is the case, yes I understand that and I expect to see the route in the UI display the custom subdomain, the docs state that the default behavior is to create a route with app name-projectname-subdomain if one isn't specifically designated. the expected behavior isn't happening, it is still using router.default.svc.cluster.local

kenk667 avatar Oct 26 '16 17:10 kenk667

@liggitt

Here is a screen shot of what I mean

default route example

kenk667 avatar Oct 26 '16 17:10 kenk667

can you attach the relevant portion of the master-config.yaml?

liggitt avatar Oct 26 '16 17:10 liggitt

@liggitt

sure thing, here you are;

master-config

kenk667 avatar Oct 26 '16 17:10 kenk667

and the yaml of that route (oc get route -n test2 -o yaml)

liggitt avatar Oct 26 '16 17:10 liggitt

@liggitt

here is the yaml for that route;

apiVersion: v1
items:
- apiVersion: v1
  kind: Route
  metadata:
    annotations:
      description: Route for application's http service.
      openshift.io/host.generated: "true"
    creationTimestamp: 2016-10-26T17:11:05Z
    labels:
      app: eap70-postgresql-persistent-s2i
      application: eap-app
      template: eap70-postgresql-persistent-s2i
      xpaas: 1.3.2
    name: eap-app
    namespace: test2
    resourceVersion: "1732"
    selfLink: /oapi/v1/namespaces/test2/routes/eap-app
    uid: 2db8b38e-9b9f-11e6-853f-005056ad53ad
  spec:
    host: eap-app-test2.router.default.svc.cluster.local
    to:
      kind: Service
      name: eap-app
      weight: 100
  status:
    ingress:
    - conditions:
      - lastTransitionTime: 2016-10-26T17:11:05Z
        status: "True"
        type: Admitted
      host: eap-app-test2.router.default.svc.cluster.local
      routerName: router
- apiVersion: v1
  kind: Route
  metadata:
    annotations:
      description: Route for application's https service.
      openshift.io/host.generated: "true"
    creationTimestamp: 2016-10-26T17:11:05Z
    labels:
      app: eap70-postgresql-persistent-s2i
      application: eap-app
      template: eap70-postgresql-persistent-s2i
      xpaas: 1.3.2
    name: secure-eap-app
    namespace: test2
    resourceVersion: "1742"
    selfLink: /oapi/v1/namespaces/test2/routes/secure-eap-app
    uid: 2db9e0be-9b9f-11e6-853f-005056ad53ad
  spec:
    host: secure-eap-app-test2.router.default.svc.cluster.local
    tls:
      termination: passthrough
    to:
      kind: Service
      name: secure-eap-app
      weight: 100
  status:
    ingress:
    - conditions:
      - lastTransitionTime: 2016-10-26T17:11:05Z
        status: "True"
        type: Admitted
      host: secure-eap-app-test2.router.default.svc.cluster.local
      routerName: router
kind: List
metadata: {}

kenk667 avatar Oct 26 '16 17:10 kenk667

and to be clear, you restarted the master with the new config, then recreated the route?

liggitt avatar Oct 26 '16 17:10 liggitt

@liggitt

Yes, several times

kenk667 avatar Oct 26 '16 17:10 kenk667

@liggitt

I've tried this in version 1.2.1, 1.3.0, and 1.3.1 and this hasn't worked once for me. The default route remains router.default.svc.cluster.local which is the default value in master-config.yaml

kenk667 avatar Oct 26 '16 17:10 kenk667

@liggitt

In case this matters, this is built on CentOS 7.2.1511

kenk667 avatar Oct 26 '16 17:10 kenk667

did you create your service file yourself? ExecStart=/opt/openshift/v1.3/openshift start doesn't tell openshift to use the config file you generated... that requires ExecStart=/opt/openshift/v1.3/openshift start --master-config=... --node-config=...

liggitt avatar Oct 26 '16 17:10 liggitt

@liggitt

It doesn't? I was under the impression that when openshift is started that the master-config.yaml is read no matter what? Is there a switch I'm missing?

kenk667 avatar Oct 26 '16 17:10 kenk667

@liggitt

Yes the service file is created as part of the build as I wanted to have openshift controlled as a service and started persistently

kenk667 avatar Oct 26 '16 17:10 kenk667

@liggitt

You've given me the idea to look around how the service I wrote starts. When I run ./opeshift start --help a man page shows that the switch is --master-config=/path/to/master-config.yaml. After making the change the service doesn't start. Try running ./openshift start --master-config=master-config.yaml/path and I get an error stating that I need to define --node-config as well is I use the --master-config switch. I add the switch and is getting invalid errors now, seems I can't run both switches at the same time as ./openshift start t --master-config='master-config.yaml/path' --node-config='path/to/node-config.yaml'

kenk667 avatar Oct 26 '16 18:10 kenk667

@liggitt

as for why the second part of the switch fails, here is the man page for those switches

--master-config='': Location of the master configuration file to run from. When running from configuration files, all other command-line arguments are ignored. --network-plugin='': The network plugin to be called for configuring networking for pods. --node-config='': Location of the node configuration file to run from. When running from configuration files, all other command-line arguments are ignored.

that means that it isn't possible to run both as any switch after the first one, no matter the order will be ignored according to the documentation

kenk667 avatar Oct 26 '16 18:10 kenk667

@liggitt

thanks for that lightbulb moment, here is what I needed to place in the ExecStart= line in my service file;

ExecStart=/opt/openshift/v1.3.1/openshift start master --config=/path/to/master-config.yaml

reloaded daemon with systemctl daemon-reload and restarted the service and tried creating a new project and it now finally uses the subdomain defined in the master-config.yaml

maybe I missed this part of the documentation? But it wasn't clear to me to use the switch --config

thanks!

kenk667 avatar Oct 26 '16 18:10 kenk667

openshift start is a combination of openshift start node and openshift start master (including the flag help). both flags are required to be set or both unset for the combined command

liggitt avatar Oct 26 '16 18:10 liggitt