kubectl, helm, and Orka
How to use kubectl
and helm
to tap into the underlying Kubernetes layer of Orka.
On this page, you will learn how to:
- Check if you're connected to the cluster and that
helm
is configured properly. - Use
kubectl
to deploy a service to all nodes and look at the load balancer behavior. - Install a
helm
chart.
Quick command summary
kubectl config view
helm env
helm repo [list / add]
kubectl create -f \*.yaml [\*.yaml must exist on your path]
kubectl get all
kubectl describe
helm install NAME REPO
helm list
Apple ARM-based Nodes Support
Deploying Kubernetes resources is currently supported on Intel nodes only.
Read more about Apple ARM-based Support to see which commands and options are supported for Apple ARM-based nodes.
Before you begin
Install kubectl
and helm
and create an Orka kube account. See Tapping into Kubernetes.
Familiarize yourself with the limitations imposed on your cluster. See Kubernetes Limitations in Orka.
Step 1: Verify that you're connected to the cluster
- Run a
kubectl
configuration check.
kubectl config view
If configured properly, you will see a similar output:
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: DATA+OMITTED
server: https://10.10.10.99:6443
name: kubernetes
contexts:
- context:
cluster: kubernetes
namespace: sandbox
user: mykubeuser
name: mykubeuser@kubernetes
current-context: mykubeuser@kubernetes
kind: Config
preferences: {}
users:
- name: mykubeuser
user:
token: eyJhbGciOiJSUz...
If the configuration is empty instead, check Tapping into Kubernetes.
- Run a
helm
version and configuration check.
helm version
helm env
You must run Helm 3.
HELM_NAMESPACE
should be set to sandbox
instead of empty or kube-system
.
- Check if you've added the helm repos.
helm repo list
If the list is empty, you need to add some helm repos with helm repo add
. For example: helm repo add stable https://kubernetes-charts.storage.googleapis.com/
Step 2: Use kubectl to deploy a service
- Create a simple
hello-kubernetes.yaml
file in the current working directory of your terminal.
# hello-kubernetes.yaml
apiVersion: v1
kind: Service
metadata:
name: hello-kubernetes
spec:
externalIPs:
- 10.10.12.5
type: LoadBalancer
ports:
- port: 80
targetPort: 8080
selector:
app: hello-kubernetes
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: hello-kubernetes
spec:
replicas: 3
selector:
matchLabels:
app: hello-kubernetes
template:
metadata:
labels:
app: hello-kubernetes
spec:
containers:
- name: hello-kubernetes
image: paulbouwer/hello-kubernetes:1.5
ports:
- containerPort: 8080
securityContext:
runAsUser: 1000
- Create the service and the pods.
kubectl create -f hello-kubernetes.yaml
- Verify the deployment.
kubectl get all
You should see a similar output:
NAME READY STATUS RESTARTS AGE
pod/hello-kubernetes-676f8cf4c4-5nms6 1/1 Running 0 8s
pod/hello-kubernetes-676f8cf4c4-5xznz 1/1 Running 0 8s
pod/hello-kubernetes-676f8cf4c4-g42w2 1/1 Running 0 8s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/hello-kubernetes LoadBalancer 10.101.35.135 10.10.10.93,10.10.12.5 80:32409/TCP 10s
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/hello-kubernetes 3/3 3 3 9s
NAME DESIRED CURRENT READY AGE
replicaset.apps/hello-kubernetes-676f8cf4c4 3 3 3 9s
- Check the replica distribution. The expected behavior is for each replica to occupy a separate node.
kubectl describe pods | grep Node
You should see a similar output:
Node: macpro-3/10.10.10.6
Node-Selectors: <none>
Node: macpro-1/10.10.10.4
Node-Selectors: <none>
Node: macpro-2/10.10.10.5
Node-Selectors: <none>
Step 3: Use helm
- Install a helm chart that works within the scope of your RBAC access to the cluster (see Limitations) and that is compatible with the Kubernetes version of your environment.
For example: cerebro.
helm install cerebro stable/cerebro
- Check your chart.
helm list
kubectl get all
You should see a similar output:
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
cerebro sandbox 1 2020-02-21 18:33:42.209952 +0200 EET deployed cerebro-1.3.1 0.8.5
---
NAME READY STATUS RESTARTS AGE
pod/cerebro-868cf95bbf-99kx2 0/1 Running 0 14s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/cerebro ClusterIP 10.98.27.91 <none> 80/TCP 14s
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/cerebro 0/1 1 0 14s
NAME DESIRED CURRENT READY AGE
replicaset.apps/cerebro-868cf95bbf 1 1 0 15s
What's next
Explore other Kubernetes operations within the limits of the RBAC configuration of your cluster.
Updated about 2 years ago