1.0.20 • Published 18 days ago

@codiac.io/codiac-aws-eks v1.0.20

Weekly downloads
-
License
ISC
Repository
-
Last release
18 days ago

aws eks

Test to create cluster locally

remember to uncomment out line 173 and 174 in authconfigindex.ts

npm run test:single -- ./src/index.spec.ts -g 'create cluster test'  --timeout 1000

npm run test:single -- ./src/index.spec.ts -g 'delete cluster test'  --timeout 1000

setup kubeconfig to point to aws cluster

aws eks update-kubeconfig --region us-east-1 --alias cluster-eks-sdk --name cluster-eks-sdk
kubectl create namespace testns
kubectl config set-context --current --namespace=testns
kubectl config view
kubectl config get-contexts
kubectl get pods -o wide 

commands

kubectl get nodes -o jsonpath='{.items[*].status.addresses[?(@.type=="ExternalIP")].address}'


kubectl exec -ti multitool-5c66dfbfd8-6msx9 -- bash -c "cat /etc/resolv.conf" 
kubectl get svc -n kube-system

create test pod in cluster

kubectl create deployment multitool --image=praqma/network-multitool -n testns
kubectl create service clusterip multitool --tcp=80:80 -n testns

install kubect shell

kubectl-node-shell

curl -LO https://github.com/kvaps/kubectl-node-shell/raw/master/kubectl-node_shell
chmod +x ./kubectl-node_shell
sudo mv ./kubectl-node_shell /usr/local/bin/kubectl-node_shell



kubectl get node
kubectl node-shell  ip-10-50-61-76.ec2.internal
kubectl node-shell ip-10-50-61-76.ec2.internal -- ls -al /etc/codiac
kubectl node-shell ip-10-50-61-76.ec2.internal -- cat /etc/codiac/kubelet-extra.json
kubectl node-shell ip-10-50-61-76.ec2.internal -- cat  /etc/codiac/kubelet.env


# Get standard bash shell
kubectl node-shell <node>

# Use X-mode (mount /host, and do not enter host namespace)
kubectl node-shell -x <node>

# Execute custom command
kubectl node-shell <node> -- echo 123

# Use stdin
cat /etc/passwd | kubectl node-shell <node> -- sh -c 'cat > /tmp/passwd'

# Run oneliner script
kubectl node-shell <node> -- sh -c 'cat /tmp/passwd; rm -f /tmp/passwd'