Common CLI Command Operations

The Alauda Container Platform provides command line tools for users to interact with the Alauda Container Platform Registry. The following are some examples of common operations and commands:

Let's assume that Alauda Container Platform Registry for the cluster has a service address of registry.cluster.local and the namespace you are currently working on is my-ns.

Contact technical services to acquire the kubectl-acp plugin and ensure it is properly installed in your environment.

Logging in Registry

Log in to the cluster's Registry by logging in to the ACP.

kubectl acp login <ACP-endpoint>

Add namespace permissions for users

Add namespace pull permission for a user.

kubectl create rolebinding <binding-name> --clusterrole=system:image-puller --user=<username> -n <namespace>

Add namespace push permissions to a user.

kubectl create rolebinding <binding-name> --clusterrole=system:image-pusher --user=<username> -n <namespace>

Add namespace permissions for a service account

Add namespace pull permission for a service account.

kubectl create rolebinding <binding-name> --clusterrole=system:image-puller --serviceaccount=<namespace>:<serviceaccount-name> -n <namespace>

Add namespace push permission for a service account.

kubectl create rolebinding <binding-name> --clusterrole=system:image-pusher --serviceaccount=<namespace>:<serviceaccount-name> -n <namespace>

Pulling Images

Pulls an image from the registry to inside the cluster (e.g., for Pod deployment).

# Pull the image named my-app, labeled latest, from the Registry of the current namespace (my-ns)
kubectl acp pull registry.cluster.local/my-ns/my-app:latest

# Pull images from other namespaces (e.g. shared-ns) (requires permission to pull from the shared-ns namespace)
kubectl acp pull registry.cluster.local/shared-ns/base-image:latest

This command verifies your identity and pull permissions in the target namespace, and then pulls the image from the Registry.

Pushing Images

Pushes locally built images or images pulled from elsewhere to a specific namespace in the registry.

You need to first tag (tag) the local image with the address and namespace format of the target Registry using a standard container command line tool such as docker.

# Tag it with the target address:
docker tag my-app:latest registry.cluster.local/my-ns/my-app:v1

# Use the kubectl command to push it to the Registry for the current namespace (my-ns)
kubectl acp push registry.cluster.local/my-ns/my-app:v1

Pushes an image from a remote image repository to a specific namespace in the Alauda Container Platform Registry.

# If your remote image repository has an image remote.registry.io/demo/my-app:latest
# Use the kubectl command to push it to the namespace(my-ns) of the registry
kubectl acp push remote.registry.io/demo/my-app:latest registry.cluster.local/my-ns/my-app:latest

This command verifies your identity and push permissions within the my-ns namespace, and then uploads the locally tagged image to Registry.