KubeSphere (v2.1.0)

Download OpenAPI specification:Download

KubeSphere OpenAPI

Authentication

jwt

Security scheme type: API Key
Header parameter name: Authorization

Identity Management

TokenReview attempts to authenticate a token to a known user. Note: TokenReview requests may be cached by the webhook token authenticator plugin in the kube-apiserver.

Authorizations:
Request Body schema: application/json
apiVersion
required
string

Kubernetes API version

kind
required
string

kind of the API object

spec
object (iam.Spec)
status
object (iam.Status)

Responses

200

ok

default

ok

post /kapis/iam.kubesphere.io/v1alpha2/authenticate
./kapis/iam.kubesphere.io/v1alpha2/authenticate

Request samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "apiVersion": "string",
  • "kind": "string",
  • "spec":
    {
    },
  • "status":
    {
    }
}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "apiVersion": "string",
  • "kind": "string",
  • "spec":
    {
    },
  • "status":
    {
    }
}

KubeSphere APIs support token-based authentication via the Authtoken request header. The POST Login API is used to retrieve the authentication token. After the authentication token is obtained, it must be inserted into the Authtoken header for all requests.

Authorizations:
Request Body schema: application/json
password
required
string

password

username
required
string

username

Responses

200

ok

default

ok

post /kapis/iam.kubesphere.io/v1alpha2/login
./kapis/iam.kubesphere.io/v1alpha2/login

Request samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "password": "string",
  • "username": "string"
}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "access_token": "string",
  • "expires_in": 0,
  • "refresh_token": "string",
  • "token_type": "string"
}

OAuth API,only support resource owner password credentials grant

Authorizations:
Request Body schema: application/json
password
required
string

password

username
required
string

username

Responses

200

ok

default

ok

post /kapis/iam.kubesphere.io/v1alpha2/token
./kapis/iam.kubesphere.io/v1alpha2/token

Request samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "password": "string",
  • "username": "string"
}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "access_token": "string",
  • "expires_in": 0,
  • "refresh_token": "string",
  • "token_type": "string"
}

List all users.

Authorizations:

Responses

200

ok

default

ok

get /kapis/iam.kubesphere.io/v1alpha2/users
./kapis/iam.kubesphere.io/v1alpha2/users

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "items":
    [
    ],
  • "total_count": 0
}

Create a user account.

Authorizations:
Request Body schema: application/json
cluster_role
required
string

user's cluster role

description
required
string

user's description

email
required
string

email address

lang
string

user's language setting, default is zh-CN

password
required
string

password'

username
required
string

username

Responses

200

ok

default

ok

post /kapis/iam.kubesphere.io/v1alpha2/users
./kapis/iam.kubesphere.io/v1alpha2/users

Request samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "cluster_role": "string",
  • "description": "string",
  • "email": "string",
  • "lang": "string",
  • "password": "string",
  • "username": "string"
}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "message": "string"
}

Describe the specified user.

Authorizations:
path Parameters
user
required
string

username

Responses

200

ok

default

ok

get /kapis/iam.kubesphere.io/v1alpha2/users/{user}
./kapis/iam.kubesphere.io/v1alpha2/users/{user}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "avatar_url": "string",
  • "cluster_role": "string",
  • "create_time": "2020-04-04T03:51:42Z",
  • "current_password": "string",
  • "description": "string",
  • "email": "string",
  • "groups":
    [
    ],
  • "lang": "string",
  • "last_login_time": "string",
  • "password": "string",
  • "role": "string",
  • "role_bind_time": "2020-04-04T03:51:42Z",
  • "role_binding": "string",
  • "roles":
    {
    },
  • "status": 0,
  • "username": "string",
  • "workspace_role": "string"
}

Update information about the specified user.

Authorizations:
path Parameters
user
required
string

username

Request Body schema: application/json
cluster_role
required
string

user's cluster role

current_password
string

this is necessary if you need to change your password

description
required
string

user's description

email
required
string

email address

lang
required
string

user's language setting, default is zh-CN

password
string

this is necessary if you need to change your password

username
required
string

username

Responses

200

ok

default

ok

put /kapis/iam.kubesphere.io/v1alpha2/users/{user}
./kapis/iam.kubesphere.io/v1alpha2/users/{user}

Request samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "cluster_role": "string",
  • "current_password": "string",
  • "description": "string",
  • "email": "string",
  • "lang": "string",
  • "password": "string",
  • "username": "string"
}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "message": "string"
}

Delete the specified user.

Authorizations:
path Parameters
user
required
string

username

Responses

200

ok

default

ok

delete /kapis/iam.kubesphere.io/v1alpha2/users/{user}
./kapis/iam.kubesphere.io/v1alpha2/users/{user}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "message": "string"
}

Retrieve the "login logs" for the specified user.

Authorizations:
path Parameters
user
required
string

username

Responses

200

ok

default

ok

get /kapis/iam.kubesphere.io/v1alpha2/users/{user}/logs
./kapis/iam.kubesphere.io/v1alpha2/users/{user}/logs

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "login_ip": "string",
  • "login_time": "string"
}

Access Management

List all cluster roles.

Authorizations:

Responses

200

ok

default

ok

get /kapis/iam.kubesphere.io/v1alpha2/clusterroles
./kapis/iam.kubesphere.io/v1alpha2/clusterroles

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "items":
    [
    ],
  • "total_count": 0
}

List all policy rules of the specified cluster role.

Authorizations:
path Parameters
clusterrole
required
string

cluster role name

Responses

200

ok

default

ok

get /kapis/iam.kubesphere.io/v1alpha2/clusterroles/{clusterrole}/rules
./kapis/iam.kubesphere.io/v1alpha2/clusterroles/{clusterrole}/rules

Response samples

Content type
application/json
Copy
Expand all Collapse all
[
  • {
    }
]

List all users that are bound to the specified cluster role.

Authorizations:
path Parameters
clusterrole
required
string

cluster role name

Responses

200

ok

default

ok

get /kapis/iam.kubesphere.io/v1alpha2/clusterroles/{clusterrole}/users
./kapis/iam.kubesphere.io/v1alpha2/clusterroles/{clusterrole}/users

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "items":
    [
    ],
  • "total_count": 0
}

List all policy rules of the specified role in the given devops project.

Authorizations:
path Parameters
devops
required
string

devops project ID

role
required
string

devops role name

Responses

200

ok

default

ok

get /kapis/iam.kubesphere.io/v1alpha2/devops/{devops}/roles/{role}/rules
./kapis/iam.kubesphere.io/v1alpha2/devops/{devops}/roles/{role}/rules

Response samples

Content type
application/json
Copy
Expand all Collapse all
[
  • {
    }
]

Retrieve the roles that are assigned to the user in the specified namespace.

Authorizations:
path Parameters
namespace
required
string

kubernetes namespace

Responses

200

ok

default

ok

get /kapis/iam.kubesphere.io/v1alpha2/namespaces/{namespace}/roles
./kapis/iam.kubesphere.io/v1alpha2/namespaces/{namespace}/roles

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "items":
    [
    ],
  • "total_count": 0
}

List all policy rules of the specified role in the given namespace.

Authorizations:
path Parameters
namespace
required
string

kubernetes namespace

role
required
string

role name

Responses

200

ok

default

ok

get /kapis/iam.kubesphere.io/v1alpha2/namespaces/{namespace}/roles/{role}/rules
./kapis/iam.kubesphere.io/v1alpha2/namespaces/{namespace}/roles/{role}/rules

Response samples

Content type
application/json
Copy
Expand all Collapse all
[
  • {
    }
]

Retrieve the users that are bound to the role in the specified namespace.

Authorizations:
path Parameters
namespace
required
string

kubernetes namespace

role
required
string

role name

Responses

200

ok

default

ok

get /kapis/iam.kubesphere.io/v1alpha2/namespaces/{namespace}/roles/{role}/users
./kapis/iam.kubesphere.io/v1alpha2/namespaces/{namespace}/roles/{role}/users

Response samples

Content type
application/json
Copy
Expand all Collapse all
[
  • {
    }
]

List all users in the specified namespace.

Authorizations:
path Parameters
namespace
required
string

kubernetes namespace

Responses

200

ok

default

ok

get /kapis/iam.kubesphere.io/v1alpha2/namespaces/{namespace}/users
./kapis/iam.kubesphere.io/v1alpha2/namespaces/{namespace}/users

Response samples

Content type
application/json
Copy
Expand all Collapse all
[
  • {
    }
]

Get the mapping relationships between cluster roles and policy rules.

Authorizations:

Responses

200

ok

default

ok

get /kapis/iam.kubesphere.io/v1alpha2/rulesmapping/clusterroles
./kapis/iam.kubesphere.io/v1alpha2/rulesmapping/clusterroles

Response samples

Content type
application/json
Copy
Expand all Collapse all
[
  • {
    }
]

Get the mapping relationships between namespaced roles and policy rules.

Authorizations:

Responses

200

ok

default

ok

get /kapis/iam.kubesphere.io/v1alpha2/rulesmapping/roles
./kapis/iam.kubesphere.io/v1alpha2/rulesmapping/roles

Response samples

Content type
application/json
Copy
Expand all Collapse all
[
  • {
    }
]

Retrieve all the roles that are assigned to the specified user.

Authorizations:
path Parameters
user
required
string

username

Responses

200

ok

default

ok

get /kapis/iam.kubesphere.io/v1alpha2/users/{user}/roles
./kapis/iam.kubesphere.io/v1alpha2/users/{user}/roles

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "clusterRole":
    [
    ],
  • "roles":
    [
    ]
}

List all members in the specified workspace.

Authorizations:
path Parameters
workspace
required
string

workspace name

Responses

200

ok

default

ok

get /kapis/iam.kubesphere.io/v1alpha2/workspaces/{workspace}/members
./kapis/iam.kubesphere.io/v1alpha2/workspaces/{workspace}/members

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "items":
    [
    ],
  • "total_count": 0
}

Invite a member to the specified workspace.

Authorizations:
path Parameters
workspace
required
string

workspace name

Request Body schema: application/json
username
required
string

username

workspace_role
required
string

user's workspace role'

Responses

200

ok

default

ok

post /kapis/iam.kubesphere.io/v1alpha2/workspaces/{workspace}/members
./kapis/iam.kubesphere.io/v1alpha2/workspaces/{workspace}/members

Request samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "username": "string",
  • "workspace_role": "string"
}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "message": "string"
}

Describe the specified user in the given workspace.

Authorizations:
path Parameters
workspace
required
string

workspace name

member
required
string

username

Responses

200

ok

default

ok

get /kapis/iam.kubesphere.io/v1alpha2/workspaces/{workspace}/members/{member}
./kapis/iam.kubesphere.io/v1alpha2/workspaces/{workspace}/members/{member}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "cluster_role": "string",
  • "create_time": "2020-04-04T03:51:42Z",
  • "description": "string",
  • "email": "string",
  • "lang": "string",
  • "last_login_time": "2020-04-04T03:51:42Z",
  • "username": "string",
  • "workspace_role": "string"
}

Remove the specified member from the workspace.

Authorizations:
path Parameters
workspace
required
string

workspace name

member
required
string

username

Responses

200

ok

default

ok

delete /kapis/iam.kubesphere.io/v1alpha2/workspaces/{workspace}/members/{member}
./kapis/iam.kubesphere.io/v1alpha2/workspaces/{workspace}/members/{member}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "message": "string"
}

List all workspace roles.

Authorizations:
path Parameters
workspace
required
string

workspace name

Responses

200

ok

default

ok

get /kapis/iam.kubesphere.io/v1alpha2/workspaces/{workspace}/roles
./kapis/iam.kubesphere.io/v1alpha2/workspaces/{workspace}/roles

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "items":
    [
    ],
  • "total_count": 0
}

Describe the workspace role.

Authorizations:
path Parameters
workspace
required
string

workspace name

role
required
string

workspace role name

Responses

200

ok

default

ok

get /kapis/iam.kubesphere.io/v1alpha2/workspaces/{workspace}/roles/{role}
./kapis/iam.kubesphere.io/v1alpha2/workspaces/{workspace}/roles/{role}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "aggregationRule":
    {
    },
  • "apiVersion": "string",
  • "kind": "string",
  • "metadata":
    {
    },
  • "rules":
    [
    ]
}

List all policy rules of the specified workspace role.

Authorizations:
path Parameters
workspace
required
string

workspace name

role
required
string

workspace role name

Responses

200

ok

default

ok

get /kapis/iam.kubesphere.io/v1alpha2/workspaces/{workspace}/roles/{role}/rules
./kapis/iam.kubesphere.io/v1alpha2/workspaces/{workspace}/roles/{role}/rules

Response samples

Content type
application/json
Copy
Expand all Collapse all
[
  • {
    }
]

Cluster Resources

get abnormal workloads' count of whole cluster

Authorizations:

Responses

200

ok

default

ok

get /kapis/resources.kubesphere.io/v1alpha2/abnormalworkloads
./kapis/resources.kubesphere.io/v1alpha2/abnormalworkloads

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "data":
    {
    },
  • "items": { },
  • "namespace": "string"
}

remove a node from service, safely evict all of your pods from a node and you can power down the node. More info: https://kubernetes.io/docs/tasks/administer-cluster/safely-drain-node/

Authorizations:
path Parameters
node
required
string

node name

Responses

200

ok

default

ok

post /kapis/resources.kubesphere.io/v1alpha2/nodes/{node}/drainage
./kapis/resources.kubesphere.io/v1alpha2/nodes/{node}/drainage

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "message": "string"
}

get whole cluster's resource usage

Authorizations:

Responses

200

ok

default

ok

get /kapis/resources.kubesphere.io/v1alpha2/quotas
./kapis/resources.kubesphere.io/v1alpha2/quotas

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "data":
    {
    },
  • "namespace": "string"
}

List all routers of all projects

Authorizations:

Responses

200

ok

default

ok

get /kapis/resources.kubesphere.io/v1alpha2/routers
./kapis/resources.kubesphere.io/v1alpha2/routers

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "apiVersion": "string",
  • "items":
    [
    ],
  • "kind": "string",
  • "metadata":
    {
    }
}

Cluster level resource query

Authorizations:
path Parameters
resources
required
string

cluster level resource type, e.g. nodes,workspaces,storageclasses,clusterroles.

query Parameters
conditions
string <key=value,key~value>

query conditions, connect multiple conditions with commas, equal symbol for exact query, wave symbol for fuzzy query e.g. name~a

paging
string <limit=%d,page=%d>
Default: "limit=10,page=1"

paging query, e.g. limit=100,page=1

reverse
string

sort parameters, e.g. reverse=true

orderBy
string

sort parameters, e.g. orderBy=createTime

Responses

200

ok

default

ok

get /kapis/resources.kubesphere.io/v1alpha2/{resources}
./kapis/resources.kubesphere.io/v1alpha2/{resources}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "items":
    [
    ],
  • "total_count": 0
}

Namespace Resources

List all applications

Authorizations:
path Parameters
namespace
required
string

the name of the project

query Parameters
conditions
string <key=value,key~value>

query conditions, connect multiple conditions with commas, equal symbol for exact query, wave symbol for fuzzy query e.g. name~a

paging
string <limit=%d,page=%d>
Default: "limit=10,page=1"

paging query, e.g. limit=100,page=1

Responses

200

ok

default

ok

get /kapis/openpitrix.io/v1/applications
./kapis/openpitrix.io/v1/applications

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "items":
    [
    ],
  • "total_count": 0
}

List all applications within the specified namespace

Authorizations:
path Parameters
namespace
required
string

the name of the project

query Parameters
conditions
string <key=value,key~value>

query conditions, connect multiple conditions with commas, equal symbol for exact query, wave symbol for fuzzy query e.g. name~a

paging
string <limit=%d,page=%d>
Default: "limit=10,page=1"

paging query, e.g. limit=100,page=1

Responses

200

ok

default

ok

get /kapis/openpitrix.io/v1/namespaces/{namespace}/applications
./kapis/openpitrix.io/v1/namespaces/{namespace}/applications

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "items":
    [
    ],
  • "total_count": 0
}

Deploy a new application

Authorizations:
path Parameters
namespace
required
string

the name of the project

Request Body schema: application/json
advanced_param
required
Array of strings
app_id
string
conf
string
runtime_id
string
version_id
string

Responses

200

ok

default

ok

post /kapis/openpitrix.io/v1/namespaces/{namespace}/applications
./kapis/openpitrix.io/v1/namespaces/{namespace}/applications

Request samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "advanced_param":
    [
    ],
  • "app_id": "string",
  • "conf": "string",
  • "runtime_id": "string",
  • "version_id": "string"
}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "message": "string"
}

Describe the specified application of the namespace

Authorizations:
path Parameters
namespace
required
string

the name of the project

application
required
string

application ID

Responses

200

ok

default

ok

get /kapis/openpitrix.io/v1/namespaces/{namespace}/applications/{application}
./kapis/openpitrix.io/v1/namespaces/{namespace}/applications/{application}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "app":
    {
    },
  • "cluster":
    {
    },
  • "ingresses":
    [
    ],
  • "name": "string",
  • "services":
    [
    ],
  • "version":
    {
    },
  • "workloads":
    {