Deploying on Kubernetes
This guide covers how to deploy Fabric components and chaincodes on a Kubernetes cluster. It assumes you have already set up a Kubernetes infrastructure and have an Infra for your cluster.
Component Deployment on Kubernetes
When deploying on Kubernetes, the workflow for creating components (organizations, peers, orderers, etc.) is nearly identical to the VM-based workflow. The key difference is:
- Instead of selecting a VM Host, you select the Infra of your Kubernetes infrastructure
- The Host is resolved automatically from the cluster configuration â you do not need to set it manually
- All other fields (name, domain, CA credentials, organization type, etc.) remain the same
Creating an Organization
Follow the same steps described in the Organization Guide, with one difference:
- Host: Instead of selecting a VM, select the Infra of your Kubernetes infrastructure. The platform will resolve the host from the cluster configuration automatically.
All other organization details remain the same:
- Organization Name: Choose a name for your organization
- Domain: Enter the domain name for your organization
- Organization Type: Select Starter or Full Organization
- Certification Authority: Configure your CA as described in the CA documentation
Creating Peers
Follow the same steps described in the Peer Guide, with one difference:
- Peer Host: Instead of selecting an available VM, the peer is deployed to the Kubernetes cluster via the Infra associated with your organization. You do not need to manually select a host.
The remaining fields are the same:
- CA User: The user for the Certificate Authority
- CA Password: The password for the Certificate Authority
Creating Orderers
Follow the same steps described in the Orderer Guide, with one difference:
- Orderer Host: Instead of selecting an available VM, the orderer is deployed to the Kubernetes cluster via the Infra. You do not need to manually select a host.
The remaining fields are the same:
- CA User: The user for the Certificate Authority
- CA Password: The password for the Certificate Authority
Creating CCApi and GoInitus
The creation of CCApi and GoInitus follows the same process as described in the Organization Guide with the difference that you must select the Kubernetes Infra when prompted for the host. The platform will handle the deployment of these components to the cluster automatically.
Chaincode Deployment on Kubernetes
Chaincode deployment on Kubernetes has one critical difference from VM-based deployment: the Deploy as a Service option must be enabled. This is the most significant change in the Kubernetes workflow.
Deploy as a Service
Required for Kubernetes: When deploying chaincode to a Kubernetes-based network, you must enable the Deploy as a Service option. This is mandatory for all chaincode deployments on Kubernetes.
When Deploy as a Service is enabled:
- A dedicated Kubernetes pod is created for the chaincode
- The chaincode runs as an independent service within the cluster, separate from the peer pods
- The peer communicates with the chaincode pod over the Kubernetes internal network
- This follows the standard Hyperledger Fabric "Chaincode as a Service" pattern
Deploying a Chaincode
The process for deploying a chaincode on Kubernetes is the same as described in the Chaincode Guide, with the addition of the deploy_as_a_service option:
- Navigate to the Channel Dashboard: In the left sidebar of the business group dashboard, select Channels
- Select the Channel: Click on the channel name to go to the channel dashboard
- Go to the Chaincodes Tab: Click on the Chaincodes tab
- Deploy the Chaincode:
- Click on Add Chaincode to create a new chaincode proposal
- Select the chaincode from your account
- Select the peers of the organization that will be part of the chaincode
- Define the endorsement policy
- Enable Deploy as a Service â this is the critical step for Kubernetes deployments
- Click Add Chaincode to create the proposal
âšī¸ Note: After the chaincode is deployed, you will see an additional pod running in your Kubernetes cluster. This pod hosts the chaincode service and communicates with the peer pods within the cluster.
Accepting the Proposal
The proposal approval process is identical to VM-based deployments. See Accepting the Proposal in the Chaincode Guide for details. Organizations accept the proposal by selecting the peers that will receive the chaincode.
Next Steps
- For all other operations (channels, business groups, members), follow the standard GoFabric guides â there are no Kubernetes-specific differences
- To learn about creating channels, see the Channel Guide
- To learn about business groups, see the Business Group Guide
- To interact with your chaincode, create a CCApi or GoInitus