This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
Chapter 2. Preparing Resources
2.1. Projects Link kopierenLink in die Zwischenablage kopiert!
2.1.1. Description of Resource Link kopierenLink in die Zwischenablage kopiert!
Projects are the unit of isolation and collaboration in OpenShift. A project has one or more members, a quota on the resources that the project may consume, and the security controls on the resources in the project. Within a project, members may have different roles - project administrators can set membership, editors can create and manage the resources, and viewers can see but not access running containers. In typical clusters, cluster administrators, rather than project administrators, can alter project quotas.
Listing or watching projects will return only projects the user has the reader role on.
An OpenShift project is an alternative representation of a Kubernetes namespace. Projects are exposed as editable to end users while namespaces are not. Direct creation of a project is typically restricted to administrators, while end users should use the ProjectRequest
resource.
2.1.2. Creating a New Project as Administrator Link kopierenLink in die Zwischenablage kopiert!
2.1.2.1. Request Breakdown Link kopierenLink in die Zwischenablage kopiert!
Creating a new project as an administrator requires one request:
-
A POST request to the
projects
resource.
The POST request to the projects
resource uses a Project
configuration in the request body.
2.1.2.2. POST Request to Create a New Project Link kopierenLink in die Zwischenablage kopiert!
Request Header
Request Body
apiVersion: v1 kind: Project metadata: name: {$PROJECT_NAME}
apiVersion: v1
kind: Project
metadata:
name: {$PROJECT_NAME}
2.1.3. Creating a New Project as User Link kopierenLink in die Zwischenablage kopiert!
2.1.3.1. Request Breakdown Link kopierenLink in die Zwischenablage kopiert!
Creating a new project as a user requires one request:
-
A POST request to the
projectrequests
resource.
The POST request uses a ProjectRequest
configuration in the request body.
2.1.3.2. POST Request to Create a New Project Link kopierenLink in die Zwischenablage kopiert!
Request Header
Request Body
apiVersion: v1 kind: ProjectRequest metadata: name: {$PROJECT_NAME}
apiVersion: v1
kind: ProjectRequest
metadata:
name: {$PROJECT_NAME}
2.1.4. Listing all Projects in an Environment Link kopierenLink in die Zwischenablage kopiert!
2.1.4.1. Request Breakdown Link kopierenLink in die Zwischenablage kopiert!
Listing all the projects in an environment requires one request:
-
A GET request to the
projects
resource.
The GET request returns a ProjectList
configuration.
2.1.4.2. GET Request to List all Projects Link kopierenLink in die Zwischenablage kopiert!
Request Header
2.1.5. Listing a Specific Project Link kopierenLink in die Zwischenablage kopiert!
2.1.5.1. Request Breakdown Link kopierenLink in die Zwischenablage kopiert!
Listing the details for a project requires three requests:
-
A GET request to the project name in the
projects
resource. -
A GET request to the
resourcequotas
subresource of the project namespace. -
A GET request to the
limitranges
subresource of the project namespace.
These requests return the Project
, ResourceQuotaList
, and LimitRangeList
configurations respectively for the project namespace.
2.1.5.2. GET Request to List the Project Configuration Link kopierenLink in die Zwischenablage kopiert!
Request Header
2.1.5.3. GET Request to List the ResourceQuotaList Configuration Link kopierenLink in die Zwischenablage kopiert!
Request Header
2.1.5.4. GET Request to List the LimitRangeList Configuration Link kopierenLink in die Zwischenablage kopiert!
Request Header
2.1.6. Deleting a Project Link kopierenLink in die Zwischenablage kopiert!
2.1.6.1. Request Breakdown Link kopierenLink in die Zwischenablage kopiert!
Deleting a project requires one request:
-
A DELETE request to the project namespace in the
projects
resource of the namespace.
The DELETE request returns a code: 200
and the project is deleted.
2.1.6.2. DELETE Request to Delete a Project Link kopierenLink in die Zwischenablage kopiert!
Request Header
2.2. Service Accounts Link kopierenLink in die Zwischenablage kopiert!
2.2.1. Description of Resource Link kopierenLink in die Zwischenablage kopiert!
ServiceAccount binds together:
- a name, understood by users, and perhaps by peripheral systems, for an identity
- a principal that can be authenticated and authorized
- a set of secrets
2.2.2. Creating a New Service Account Link kopierenLink in die Zwischenablage kopiert!
2.2.2.1. Request Breakdown Link kopierenLink in die Zwischenablage kopiert!
Creating a new service account requires one request:
-
A POST request to the
serviceaccounts
subresource of the namespace.
The POST request uses a ServiceAccount
configuration in the request body.
2.2.2.2. POST Request to Create a New Service Account Link kopierenLink in die Zwischenablage kopiert!
Request Header
Request Body
apiVersion: v1 kind: ServiceAccount metadata: name: {$SERVICEACCOUNT}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {$SERVICEACCOUNT}
2.2.3. Listing All Service Accounts in an Environment Link kopierenLink in die Zwischenablage kopiert!
2.2.3.1. Request Breakdown Link kopierenLink in die Zwischenablage kopiert!
Listing all the service accounts in an environment requires one request:
-
A GET request to the
serviceaccounts
resource.
The GET request returns the ServiceAccountList
, listing the details of all service accounts in the environment.
2.2.3.2. GET Request to Return All Service Accounts in an Environment Link kopierenLink in die Zwischenablage kopiert!
Request Header
2.2.4. Listing all Service Accounts in a Namespace Link kopierenLink in die Zwischenablage kopiert!
2.2.4.1. Request Breakdown Link kopierenLink in die Zwischenablage kopiert!
Listing all the service accounts in a namespace requires one request:
-
A GET request to the
serviceaccounts
subresource of the namespace.
The GET request returns the ServiceAccountList
, listing the details of all service accounts in the namespace.
2.2.4.2. GET Request to Return Service Accounts in Namespace Link kopierenLink in die Zwischenablage kopiert!
Request Header
2.2.5. Listing a Specific Service Account Configuration Link kopierenLink in die Zwischenablage kopiert!
2.2.5.1. Request Breakdown Link kopierenLink in die Zwischenablage kopiert!
Listing a specific service account configuration requires one request:
-
A GET request to the service account name in the
serviceaccounts
subresource of the namespace.
The GET request returns the ServiceAccount
configuration for the specified service account.
2.2.5.2. GET Request to Return Specific Service Account Configuration Link kopierenLink in die Zwischenablage kopiert!
Request Header
2.2.6. Adding a Role to a Service Account Link kopierenLink in die Zwischenablage kopiert!
2.2.6.1. Request Breakdown Link kopierenLink in die Zwischenablage kopiert!
Adding a role to a service account requires two requests, where the second request type is dependent on the response of the first:
-
A GET request to the
policybindings
subresource of the namespace. -
A POST request to the
rolebindings
subresource of the namespace (if the role has not been previously bound to an object in the namespace) +. OR -
A PUT request to the role name in the
rolebindings
subresource of the namespace.
The GET request returns the PolicyBindingList
, listing all the RoleBinding
configurations in the namespace.
Create a RoleBinding
with a POST request to bind an object to a role. Once the role binding exists in the namespace, binding another object to that role requires modification of the RoleBinding
with a PUT request.
2.2.6.2. GET Request to Return PolicyBindingList in Namespace Link kopierenLink in die Zwischenablage kopiert!
Request Header
The GET request returns a list of the role bindings that are present in the namespace.
Response Body Snippet
If the intended role is not listed, send a POST request to create the RoleBinding
configuration. Include the service account as a subject
for the role, and the system:serviceaccount:{$PROJECT}:{$SERVICEACCOUNT}
user name that distinguishes the service account.
If the role is listed, as in the response in the example above, update the returned RoleBinding
configuration with the subject
and userName
of the service account being added to the role and send it as a PUT request to the role name in the rolebindings
subresource of the namespace.
2.2.6.3. POST Request to Create a RoleBinding in a Namespace Link kopierenLink in die Zwischenablage kopiert!
Request Header
Request Body
2.2.6.4. PUT Request to Add a Service Account to an Existing Role Link kopierenLink in die Zwischenablage kopiert!
Request Header
Request Body
2.2.7. Linking a Secret to a Service Account Link kopierenLink in die Zwischenablage kopiert!
2.2.7.1. Request Breakdown Link kopierenLink in die Zwischenablage kopiert!
Linking a secret to a service account requires two requests:
-
A GET request to the service account name in the
serviceaccounts
subresource of the namespace. -
A PUT request with updated
secrets
parameter to the service account name in theserviceaccounts
subresource of the namespace.
The GET request returns the ServiceAccount
configuration.
The PUT request uses the returned ServiceAccount
configuration with an updated secrets
parameter to include the secret to link to the service account.
2.2.7.2. GET Request to Return Service Account Configuration Link kopierenLink in die Zwischenablage kopiert!
Request Header
Request Body Snippet
... secrets: - name: {$SERVICEACCOUNT}-token-x4tx5 - name: {$SERVICEACCOUNT}-dockercfg-7qfh6 ...
...
secrets:
- name: {$SERVICEACCOUNT}-token-x4tx5
- name: {$SERVICEACCOUNT}-dockercfg-7qfh6
...
2.2.7.3. PUT Request to Add Secret to Service Account Configuration Link kopierenLink in die Zwischenablage kopiert!
Request Header
Request Body Snippet
2.2.8. Unlinking a Secret from a Service Account Link kopierenLink in die Zwischenablage kopiert!
2.2.8.1. Request Breakdown Link kopierenLink in die Zwischenablage kopiert!
Unlinking a secret from a service account requires two requests:
-
A GET request to the service account name in the
serviceaccounts
subresource of the namespace. -
A PUT request with modified
secrets
parameter to the service account name in theserviceaccounts
subresource of the namespace.
The GET request returns the ServiceAccount
configuration.
The PUT request uses the returned ServiceAccount
configuration with a modified secrets
parameter to unlink the secret from the service account.
2.2.8.2. GET Request to Return Service Account Configuration Link kopierenLink in die Zwischenablage kopiert!
Request Header
Request Body Snippet
2.2.8.3. PUT Request to Remove Secret from Service Account Configuration Link kopierenLink in die Zwischenablage kopiert!
Request Header
Request Body Snippet
... secrets: - name: {$SERVICEACCOUNT}-token-x4tx5 - name: {$SERVICEACCOUNT}-dockercfg-7qfh6 ...
...
secrets:
- name: {$SERVICEACCOUNT}-token-x4tx5
- name: {$SERVICEACCOUNT}-dockercfg-7qfh6
...
2.2.9. Deleting a Service Account Link kopierenLink in die Zwischenablage kopiert!
2.2.9.1. Request Breakdown Link kopierenLink in die Zwischenablage kopiert!
Deleting a service account requires one request:
-
A DELETE request to the service account name in the
serviceaccounts
subresource of the namespace.
The DELETE request returns a code: 200
and the service account is deleted.
2.2.9.2. DELETE Request to Delete Service Account Link kopierenLink in die Zwischenablage kopiert!
Request Header
2.3. Secrets Link kopierenLink in die Zwischenablage kopiert!
2.3.1. Description of Resource Link kopierenLink in die Zwischenablage kopiert!
The Secret
resource type provides a mechanism to hold sensitive information such as passwords, OpenShift Container Platform client configuration files, dockercfg
files, private source repository credentials, and so on. Secrets decouple sensitive content from the pods.
2.3.2. Creating Secrets from File Link kopierenLink in die Zwischenablage kopiert!
2.3.2.1. Request Breakdown Link kopierenLink in die Zwischenablage kopiert!
Creating a new secret requires one request:
-
A POST request to the
secrets
subresource of the namespace.
The POST request to the secret
subresource uses a Secret
configuration in the request body.
2.3.2.2. POST Request to Create a New Secret Link kopierenLink in die Zwischenablage kopiert!
Request Header
Request Body
Parameter Name | Description | Additional Notes |
---|---|---|
| Base64-encoded contents of file, where the {$FILENAME} parameter is the plaintext file name |
If the file is already encrypted, the |
| Base64-encoded user name for basic authentication | |
| Base64-encoded password for the supplied basic authentication user name | |
| Base64-encoded contents of certificate file | |
| Base64-encoded contents of SSH private key file |
2.3.3. Listing Secrets in an Environment Link kopierenLink in die Zwischenablage kopiert!
2.3.3.1. Request Breakdown Link kopierenLink in die Zwischenablage kopiert!
Listing all the secrets in an environment requires one request:
-
A GET request to the
secrets
resource.
The GET request to the secrets
resource returns returns the SecretList
, listing the details for all secrets in the environment.
2.3.3.2. GET Request to Return All Secrets in an Environment Link kopierenLink in die Zwischenablage kopiert!
Request Header
2.3.4. Listing Secrets in a Namespace Link kopierenLink in die Zwischenablage kopiert!
2.3.4.1. Request Breakdown Link kopierenLink in die Zwischenablage kopiert!
Listing all the secrets in a namespace requires one request:
-
A GET request to the
secrets
subresource of the namespace.
The GET request to the secrets
resource returns the SecretList
, listing the details of all secrets in the namespace.
2.3.4.2. GET Request to Return Secrets in Namespace Link kopierenLink in die Zwischenablage kopiert!
Request Header
2.3.5. Listing a Specific Secret Configuration Link kopierenLink in die Zwischenablage kopiert!
2.3.5.1. Request Breakdown Link kopierenLink in die Zwischenablage kopiert!
Listing a specific secret configuration requires one request:
-
A GET request to the secret name in the
secrets
subresource of the namespace.
The GET request returns the Secret
configuration for the specified secret.
2.3.5.2. GET Request to Return Specific Secret Configuration Link kopierenLink in die Zwischenablage kopiert!
Request Header
2.3.6. Linking a Secret to a Service Account Link kopierenLink in die Zwischenablage kopiert!
2.3.6.1. Request Breakdown Link kopierenLink in die Zwischenablage kopiert!
Linking a secret to a service account requires two requests:
-
A GET request to the service account name in the
serviceaccounts
subresource of the namespace. -
A PUT request with updated
secrets
parameter to the service account name in theserviceaccounts
subresource of the namespace.
The GET request returns the ServiceAccount
configuration.
The PUT request uses the returned ServiceAccount
configuration with an updated secrets
parameter to include the secret to link to the service account.
2.3.6.2. GET Request to Return Service Account Configuration Link kopierenLink in die Zwischenablage kopiert!
Request Header
Request Body Snippet
... secrets: - name: {$SERVICEACCOUNT}-token-x4tx5 - name: {$SERVICEACCOUNT}-dockercfg-7qfh6 ...
...
secrets:
- name: {$SERVICEACCOUNT}-token-x4tx5
- name: {$SERVICEACCOUNT}-dockercfg-7qfh6
...
2.3.6.3. PUT Request to Add Secret to Service Account Configuration Link kopierenLink in die Zwischenablage kopiert!
Request Header
Request Body Snippet
2.3.7. Unlinking a Secret from a Service Account Link kopierenLink in die Zwischenablage kopiert!
2.3.7.1. Request Breakdown Link kopierenLink in die Zwischenablage kopiert!
Unlinking a secret from a service account requires two requests:
-
A GET request to the service account name in the
serviceaccounts
subresource of the namespace. -
A PUT request with modified
secrets
parameter to the service account name in theserviceaccounts
subresource of the namespace.
The GET request returns the ServiceAccount
configuration.
The PUT request uses the returned ServiceAccount
configuration with a modified secrets
parameter to unlink the secret from the service account.
2.3.7.2. GET Request to Return Service Account Configuration Link kopierenLink in die Zwischenablage kopiert!
Request Header
Request Body Snippet
2.3.7.3. PUT Request to Remove Secret from Service Account Configuration Link kopierenLink in die Zwischenablage kopiert!
Request Header
Request Body Snippet
... secrets: - name: {$SERVICEACCOUNT}-token-x4tx5 - name: {$SERVICEACCOUNT}-dockercfg-7qfh6 ...
...
secrets:
- name: {$SERVICEACCOUNT}-token-x4tx5
- name: {$SERVICEACCOUNT}-dockercfg-7qfh6
...
2.3.8. Deleting a Service Account Link kopierenLink in die Zwischenablage kopiert!
2.3.8.1. Request Breakdown Link kopierenLink in die Zwischenablage kopiert!
Deleting a service account requires one request:
-
A DELETE request to the service account name in the
serviceaccounts
subresource of the namespace.
The DELETE request returns a code: 200
and the service account is deleted.
2.3.8.2. DELETE Request to Delete Service Account Link kopierenLink in die Zwischenablage kopiert!
Request Header
2.3.9. Deleting Secrets Link kopierenLink in die Zwischenablage kopiert!
2.3.9.1. Request Breakdown Link kopierenLink in die Zwischenablage kopiert!
Deleting a secret requires one request:
-
A DELETE request to the secret name in the
secret
subresource of the namespace.
The *DELETE request returns a code: 200
and the secret is deleted.
2.3.9.2. DELETE Request to Delete Secret Link kopierenLink in die Zwischenablage kopiert!
Request Header
2.4. Persistent Volumes Link kopierenLink in die Zwischenablage kopiert!
2.4.1. Description of Resource Link kopierenLink in die Zwischenablage kopiert!
PersistentVolume (PV) is a storage resource provisioned by an administrator. It is analogous to a node.
2.4.2. Creating a New Persistent Volume Link kopierenLink in die Zwischenablage kopiert!
2.4.2.1. Request Breakdown Link kopierenLink in die Zwischenablage kopiert!
Creating a new persistent volume requires one request:
-
A POST request to the
persistentvolumes
resource.
The POST request uses a PersistentVolume
configuration in the request body.
2.4.2.2. POST Request to Create a Persistent Volume Link kopierenLink in die Zwischenablage kopiert!
Request Header
Request Body
2.4.3. Listing All Persistent Volumes in an Environment Link kopierenLink in die Zwischenablage kopiert!
2.4.3.1. Request Breakdown Link kopierenLink in die Zwischenablage kopiert!
Listing all the persistent volumes in an environment requires one request:
-
A GET request to the
persistentvolumes
resource.
The GET request returns returns the PersistentVolumeList
, listing the details of all persistent volumes in the environment.
2.4.3.2. GET Request to Return All Persistent Volumes in an Environment Link kopierenLink in die Zwischenablage kopiert!
Request Header
2.4.4. Listing a Specific Persistent Volume Configuration Link kopierenLink in die Zwischenablage kopiert!
2.4.4.1. Request Breakdown Link kopierenLink in die Zwischenablage kopiert!
Listing a specific persistent volumes configuration requires one request:
-
A GET request to the persistent volume name in the
persistentvolumes
resource.
The GET request returns the PersistentVolume
configuration for the specified persistent volume.
2.4.4.2. GET Request to Return Specific Persistent Volume Configuration Link kopierenLink in die Zwischenablage kopiert!
Request Header
2.4.5. Deleting a Persistent Volume Link kopierenLink in die Zwischenablage kopiert!
2.4.5.1. Request Breakdown Link kopierenLink in die Zwischenablage kopiert!
Deleting a persistent volume requires one request:
-
A DELETE request to the persistent volume name in the
persistentvolumes
resource.
The DELETE request returns a code: 200
and the persistent volume is deleted.
2.4.5.2. DELETE Request to Delete Persistent Volume Link kopierenLink in die Zwischenablage kopiert!
Request Header
2.5. Persistent Volume Claims Link kopierenLink in die Zwischenablage kopiert!
2.5.1. Description of Resource Link kopierenLink in die Zwischenablage kopiert!
PersistentVolumeClaim is a user’s request for and claim to a persistent volume.
2.5.2. Creating a New Persistent Volume Claim Link kopierenLink in die Zwischenablage kopiert!
2.5.2.1. Request Breakdown Link kopierenLink in die Zwischenablage kopiert!
Creating a new persistent volume claim requires one request:
-
A POST request to the
persistentvolumeclaims
subresource of the namespace.
The POST request uses a PersistentVolumeClaim
configuration in the request body.
2.5.2.2. POST Request to Create a Persistent Volume Claim Link kopierenLink in die Zwischenablage kopiert!
Request Header
Request Body
2.5.3. Listing All Persistent Volume Claims in an Environment Link kopierenLink in die Zwischenablage kopiert!
2.5.3.1. Request Breakdown Link kopierenLink in die Zwischenablage kopiert!
Listing all the persistent volume claims in an environment requires one request:
-
A GET request to the
persistentvolumeclaims
resource.
The GET request returns the PersistentVolumeClaimList
, listing the details of all persistent volume claims in the environment.
2.5.3.2. GET Request to Return All Persistent Volume Claims in an Environment Link kopierenLink in die Zwischenablage kopiert!
Request Header
2.5.4. Listing all Persistent Volume Claims in a Namespace Link kopierenLink in die Zwischenablage kopiert!
2.5.4.1. Request Breakdown Link kopierenLink in die Zwischenablage kopiert!
Listing all the persistent volume claims in a namespace requires one request:
-
A GET request to the
persistentvolumeclaims
subresource of the namespace.
The GET request returns the PersistentVolumeClaimList
, listing the details of all persistent volume claims in the namespace.
2.5.4.2. GET Request to Return Persistent Volume Claims in Namespace Link kopierenLink in die Zwischenablage kopiert!
Request Header
2.5.5. Listing a Specific Persistent Volume Claim Configuration Link kopierenLink in die Zwischenablage kopiert!
2.5.5.1. Request Breakdown Link kopierenLink in die Zwischenablage kopiert!
Listing a specific persistent volume claim configuration requires one request:
-
A GET request to the persistent volume claim name in the
persistentvolumeclaims
subresource of the namespace.
The GET request returns the PersistentVolumeClaim
configuration for the specified persistent volume claim.
2.5.5.2. GET Request to Return Specific Persistent Volume Claim Configuration Link kopierenLink in die Zwischenablage kopiert!
Request Header
2.5.6. Adding a Persistent Volume Claim to an Object Link kopierenLink in die Zwischenablage kopiert!
Persistent volume claims can be added to objects that have a pod template: deploymentconfigs, replication controllers, and pods. However, you can not change a pod’s volumes once it has been created.
If you alter a volume setting on a deployment config, a deployment will be triggered. Changing a replication controller will not affect running pods.
Adding a persistent volume claim to an object configuration requires two requests:
-
A GET request to the object name in the
{$OBJECT}
subresource of the namespace. -
A PATCH request with updated field values to the object name in the
{$OBJECT}
subresource of the namespace.
The GET request is optional as the PATCH request body is not determined by the returned configuration, however it can be useful for preparing the PATCH request body.
The syntax for the PATCH request is the same for both deploymentconfig
and replicationcontroller
objects.
2.5.6.1. PATCH Request to Add Persistent Volume Claim Link kopierenLink in die Zwischenablage kopiert!
PATCH requests require JSON formatting.
The following PATCH request example adds a persistent volume claim {$CLAIM}, which is bound to persistent volume {$VOLUME), to deploymentconfig
{$DEPLOYMENTCONFIG}. The same PATCH can be applied to a replicationcontroller
object with modified target:
Request Header
Request Body
2.5.7. Removing a Persistent Volume Claim from an Object Link kopierenLink in die Zwischenablage kopiert!
If you alter a volume setting on a deployment config, a deployment will be triggered. Changing a replication controller will not affect running pods.
Removing a persistent volume claim from an object configuration requires two requests:
-
A GET request to the object name in the
{$OBJECT}
subresource of the namespace. -
A PATCH request with a
delete
$patch
type to the object name in the{$OBJECT}
subresource of the namespace.
The GET request is optional as the PATCH request body is not determined by the returned configuration, however it can be useful for preparing the PATCH request body.
The syntax for the PATCH request is the same for both deploymentconfig
and replicationcontroller
objects.
2.5.7.1. PATCH Request to Add Persistent Volume Claim Link kopierenLink in die Zwischenablage kopiert!
PATCH requests require JSON formatting.
The following PATCH request example adds a persistent volume claim {$CLAIM}, which is bound to persistent volume {$VOLUME), to deploymentconfig
{$DEPLOYMENTCONFIG}. The same PATCH can be applied to a replicationcontroller
object with modified target:
Request Header
Request Body
2.5.8. Deleting a Persistent Volume Claim Link kopierenLink in die Zwischenablage kopiert!
2.5.8.1. Request Breakdown Link kopierenLink in die Zwischenablage kopiert!
Deleting a persistent volume claim requires one request:
-
A DELETE request to the persistent volume claim name in the
persistentvolumeclaims
subresource of the namespace.
The DELETE request returns a code: 200
and the persistent volume claim is deleted.
2.5.8.2. DELETE Request to Delete Persistent Volume Claim Link kopierenLink in die Zwischenablage kopiert!
Request Header