You should avoid exporting secrets without being more specific by using a label 
selector or by name. This is because you will pick up special secrets related 
to that project instance. Loading those special secrets into a new project may 
break that project. Similar reason as to why have to be careful with service 
accounts and role bindings. Work out just the extra ones required by the 
application.

This is why should not always export secrets.

Graham

> On 2 Jun 2018, at 16:58, Aleksandar Lazic <[email protected]> wrote:
> 
> Hi.
> 
>> On 02/06/2018 13:18, Graham Dumpleton wrote:
>> For the basic Python application you wouldn't need to export most of
>> those and for some doing so would cause problems when you try to load
>> them again.
>> 
>> For a basic application with no secrets, configmaps or persistent
>> volumes, all you need is:
>> 
>>   oc export is,bc,dc,svc,route -o yaml
> 
> Just to be on the save site please add cm (=configmap ) and secrets to
> the export also, for the future case.
> 
> oc export is,bc,dc,svc,route,cm,secrets -o yaml
> 
>> Do not include pods, replicationcontrollers or endpoints.
>> 
>> You also want to be selective about what you export by using a label
>> selector.
>> 
>>   oc export is,bc,dc,svc,route --selector app=yourappname -o yaml
>> 
>> That way you get just what is necessary for the application.
>> 
>> Before they can be reloaded in a fresh project or OpenShift instance,
>> you would usually need to massage the result, especially fixing up
>> image references and reverting them to image stream references.
>> 
>> Overall you are better off to export as a template and edit the result
>> to create a template you can then deploy multiple times, where the
>> application name is parameterised.
> 
> Full ack, the command looks then like this.
> 
> FYI: As always in yaml **don't use TABS**
> 
> ```
> oc export is,bc,dc,svc,route,cm,secrets -o yaml 
> --as-template=MyPersonalTemplate
> ```
> 
> That's the link to the template doc
> https://docs.openshift.org/3.9/dev_guide/templates.html
> 
>> Graham
> 
> Best regards
> Aleks
> 
>>> On 2 Jun 2018, at 2:01 am, Brian Keyes <[email protected]> wrote:
>>> 
>>> I am attempting to follow these instructions
>>> 
>>> https://docs.openshift.com/container-platform/3.7/day_two_guide/project_level_tasks.html
>>>  
>>> <https://docs.openshift.com/container-platform/3.7/day_two_guide/project_level_tasks.html>
>>> 
>>> I want to backup THE sample python app and I created a script like this ( 
>>> from the documentation)
>>> 
>>> 
>>> 
>>> 
>>> $ for object in rolebindings serviceaccounts secrets imagestreamtags 
>>> podpreset cms egressnetworkpolicies rolebindingrestrictions limitranges 
>>> resourcequotas pvcs templates cronjobs statefulsets hpas deployments 
>>> replicasets poddisruptionbudget endpoints
>>> do
>>>  oc export $object -o yaml > $object.yaml
>>> done
>>> 
>>> --
>>> but when I run this I get some access denied errors like this , is this 
>>> saying that the objects I am attempting to back up do not exist?
>>> 
>>> 
>>> $ ./exportotherprojects.sh
>>> error: no resources found - nothing to export
>>> the server doesn't have a resource type "cms"
>>> Error from server (Forbidden): User "admin" cannot list 
>>> egressnetworkpolicies.network.openshift.io 
>>> <http://egressnetworkpolicies.network.openshift.io/> in the namespace 
>>> "sample-py": User "admin" cannot list 
>>> egressnetworkpolicies.network.openshift.io 
>>> <http://egressnetworkpolicies.network.openshift.io/> in project "sample-py" 
>>> (get egressnetworkpolicies.network.openshift.io 
>>> <http://egressnetworkpolicies.network.openshift.io/>)
>>> error: no resources found - nothing to export
>>> error: no resources found - nothing to export
>>> error: no resources found - nothing to export
>>> the server doesn't have a resource type "pvcs"
>>> error: no resources found - nothing to export
>>> error: no resources found - nothing to export
>>> error: no resources found - nothing to export
>>> the server doesn't have a resource type "hpas"
>>> error: no resources found - nothing to export
>>> error: no resources found - nothing to export
>>> Error from server (Forbidden): User "admin" cannot list 
>>> poddisruptionbudgets.policy in the namespace "sample-py": User "admin" 
>>> cannot list poddisruptionbudgets.policy in project "sample-py" (get 
>>> poddisruptionbudgets.policy)
>>> 
>>> 
>>> thanks
>>> 
>>> _______________________________________________
>>> users mailing list
>>> [email protected]
>>> http://lists.openshift.redhat.com/openshiftmm/listinfo/users
>> 
> 
>> _______________________________________________
>> users mailing list
>> [email protected]
>> http://lists.openshift.redhat.com/openshiftmm/listinfo/users
> 

_______________________________________________
users mailing list
[email protected]
http://lists.openshift.redhat.com/openshiftmm/listinfo/users

Reply via email to