I'm using openshift container cluster to run my project.
In my CI I'm using helm and kubectl to upgrade and rollout the deployments.
Following this guide, I have created this simple DeploymentConfig:
apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
...
When I run helm upgrade --install I can see the new deployment in my openshift cluster.
But I want to rollout the deployment using kubectl and it fails:
helm upgrade --install --wait --namespace myapp nginx chart/
kubectl rollout status -n myapp -w "dc/nginx"
I'm getting this error error: no king "DeploymentConfig" is registered for version "apps.openshift.io/v1" in scheme "k8s.io/kubernetes/pkg/kubectl/scheme/scheme.go:28"
Running kubectl api-versions does display "apps.openshift.io/v1" though.
Why can't I rollout the deployment using kubectl?
Kubernetes' command line interface (CLI), kubectl, is used to run commands against Kubernetes cluster, while DeploymentConfigsis specific to OpenShift distributions, and not available in standard Kubernetes.
Though, as long as oc is built on top of kubectl, converting a kubectl binary to oc is as simple as changing the binary’s name from kubectl to oc.
See more information for using kubectl and oc
Related
In kubernetes there is a rolling update (automatically without downtime) but there is not a rolling restart, at least i could not find. We have to change deployment yaml. Is there a way to make rolling "restart", preferably without changing deployment yaml?
Before kubernetes 1.15 the answer is no. But there is a workaround of patching deployment spec with a dummy annotation:
kubectl patch deployment web -p \
"{\"spec\":{\"template\":{\"metadata\":{\"annotations\":{\"date\":\"`date +'%s'`\"}}}}}"
As of kubernetes 1.15 you can use:
kubectl rollout restart deployment your_deployment_name
CLI Improvements
Created a new kubectl rollout restart command that does a rolling restart of a deployment.
kubectl rollout restart now works for DaemonSets and StatefulSets
If you use k9s, the restart command can be found if you select deployments, statefulsets or daemonsets:
I've installed ArgoCD on my kubernetes cluster using
kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
Now, how to remove it from the cluster totally?
You can delete the entire installation using this - kubectl delete -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
Reference
When I use the kubectl run command instead of creating a deployment it creates a pod/selenium-node-chrome and as a result, I am unable to scale the selenium-node-chrome using the replicas command.
PS C:\Users\Test> kubectl run selenium-node-chrome --image selenium/node-chrome:latest --env="HUB_PORT_4444_TCP_ADDR=selenium-hub" --env="HUB_PORT_4444_TCP_PORT=4444"
pod/selenium-node-chrome created
PS C:\Users\Test> kubectl scale deployment selenium-node-chrome --replicas=5
Error from server (NotFound): deployments.extensions "selenium-node-chrome" not found
The video tutorial that I followed successfully created deployment "selenium-node-chrome" after running the same command. Please I need help and I am new to Kubernetes. Thanks.
You should use a generator
kubectl run selenium-node-chrome \
--image selenium/node-chrome:latest \
--env="HUB_PORT_4444_TCP_ADDR=selenium-hub" \
--env="HUB_PORT_4444_TCP_PORT=4444" \
--generator=deployment/apps.v1beta1
https://v1-17.docs.kubernetes.io/docs/reference/kubectl/conventions/#generators
All generators are deprecated in Kubernetes version 1.18. From the docs here
Note: All kubectl generators are deprecated. See the Kubernetes v1.17
documentation for a list of generators and how they were used.
You can use kubectl create deployment my-dep --image=busybox to create a deployment.
Also to create a yaml file use kubectl create deployment my-dep --image=busybox --dry-run=client -o yaml > deployment.yaml and then edit the yaml file to add env or any other details and apply the yaml via kubectl apply -f deployment.yaml
During Installation of Helm3 stable, i found Helm3 stable does not implement tiller deployment for fetching cluster details, it works as a Client utility only, my question is it, if it is not implementing tiller concept for fetching details, how does it connect with EKS.
I have already installed kubectl and it is running fine, is it something like this, helm client is dependent on kubectl service?
I performed following steps:
1.helm version
version.BuildInfo{Version:"v3.1.0", GitCommit:"b29d20baf09943e134c2fa5e1e1cab3bf93315fa", GitTreeState:"clean", GoVersion:"go1.13.7"}
2.kubectl create serviceaccount tiller --namespace kube-system
serviceaccount/tiller created
3.notepad rbac-config.yaml
4.kubectl apply -f rbac-config.yaml
clusterrolebinding.rbac.authorization.k8s.io/tiller-role-binding created
5.helm init --service-account tiller
Error: unknown flag: --service-account
I know steps 2,3,4 are not required in Helm3, but curious to know how helm3 interacts as a client service with EKS cluster.
Just like kubectl, helm also uses kubeconfig to communicate with the cluster.
So, both kubectl and helm depend on the cluster's config file rather depending on each other.
new to calico, trying to secure Kubernetes cluster using calico.
I have installed kubectl using command curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl referring the docs here.
I tried to install Calico Kubernetes NetworkPolicy using kubectl commands by refereeing here : kubectl create ns policy-demo creating namespace
This is then followed by creating nginx pod and services:
kubectl run --namespace=policy-demo nginx --replicas=2 --image=nginx
kubectl expose --namespace=policy-demo deployment nginx --port=80
Now, I want to uninstall and remove the policy-demo and namespace from the system.
Is there is ant way I can do it and remove this from my system using command?
How can I uninstall and remove the policy-demo?
There is a simple way of doing it.
You just need to use kubectl delete ns policy-demo to remove, clean and will delete the policy-demo namespace from the system using kubectl command.
It is already mentioned here in the end of the document: https://docs.projectcalico.org/v2.6/getting-started/kubernetes/tutorials/simple-policy